美文网首页
mysql 8.0.12 用户权限命令

mysql 8.0.12 用户权限命令

作者: Lanjerry | 来源:发表于2018-10-17 18:55 被阅读0次

示例:用户名mayiic_dev 密码mayiic123

1.创建用户:

create user 'mayiic_dev'@'%' identified by 'mayiic123';

2.修改加密规则:

alter user 'mayiic_dev'@'%' identified with mysql_native_password by 'mayiic123';

3.赋予insert,select,update权限和全部权限,“test01”为数据库,“mayiic_dev”为用户:

grant insert,select,update on test01.* to 'mayiic_dev'@'%';
grant all privileges on test01.* to 'mayiic_dev'@'%';

4.刷新权限:

flush privileges;

5.查看权限:

show grants for mayiic_dev;

6.删除用户:

drop user mayiic_dev@'%';

7.用客户软件如navicat连接mysql报错“caching-sha2-password”,原因是mysql8.0采用了新的更安全的验证方式,修改配置文件

vim /etc/my.cnf

加入内容:default_authentication_plugin=mysql_native_password


image.png

*注意:如果连接不上,查看防火墙firewalld或者iptables是否关闭,开启的话是否开放对应mysql的端口,云服务器的话查看安全组是否开放对应的mysql端口

相关文章

网友评论

      本文标题:mysql 8.0.12 用户权限命令

      本文链接:https://www.haomeiwen.com/subject/jnnrzftx.html