centos7 mysql怎么添加权限
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了centos7 mysql怎么添加权限相关的知识,希望对你有一定的参考价值。
参考技术A 创建新的用户名和密码create
user
username
identified
by
password
给用户分配权限
GRANT
privileges
ON
databasename.tablename
TO
'username'@'host'
grant
all
privileges
on
*.*
to
'username'@'localhost'
identified
by
'password'
删除权限
REVOKE
ALL
PRIVILEGES
ON
*.*
FROM
'username'@'localhost';
分配指定库的权限
GRANT
ALL
PRIVILEGES
ON
database1.*
TO
'username'@'localhost'
IDENTIFIED
BY
'password';
分配指定操作的权限
GRANT
SELECT,
UPDATE
ON
database1.*
TO
'username'@'localhost'
IDENTIFIED
BY
'password';
刷新权限
FLUSH
PRIVILEGES
删除用户
DROP
USER
username@localhost;
设置默认的编码
修改/etc/my.cnf配置文件,在[mysqld]下添加编码配置,如下所示
character_set_server=utf8
init_connect='SET
NAMES
utf8'
重启mysql
systemctl
restart
mysqld
更新用户的密码
SET
PASSWORD
FOR
'username'@'localhost'
=
PASSWORD("123456");
centos7安装mysql5.7(rpm安装版)与 Mysql 权限
centos7安装mysql5.7(rpm安装版)
网址:https://www.cnblogs.com/helf/p/11244711.html
Mysql 权限管理
网址: https://www.cnblogs.com/wangyueping/p/11258028.html
以上是关于centos7 mysql怎么添加权限的主要内容,如果未能解决你的问题,请参考以下文章
Linux Centos7 Mysql 忘记密码怎么找回密码