centos7 开启 mysql8 远程控制

mysql8.x密码的认证方式变了,需要修改远程认证方式

方法1

CREATE USER 'root'@'%' IDENTIFIED WITH mysql_native_password  BY '123123';      //修改密码认证方式为mysql_native_password

GRANT ALL ON *.* TO 'root'@'%';

mysql> CREATE USER 'root'@'%' IDENTIFIED WITH mysql_native_password  BY '123123';  # 执行此命令后在远程使用root账户登录,密码为123456
mysql> GRANT ALL ON *.* TO 'root'@'%';  # 授权
mysql> FLUSH PRIVILEGES;  # 刷新

方法2

CREATE USER 'root'@'%' IDENTIFIED BY '123123';     //默认的密码认证插件caching_sha2_password

GRANT ALL ON *.* TO 'root'@'%'; 

ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY '123123';

mysql> CREATE USER 'root'@'%' IDENTIFIED BY '123456';  # 执行此命令后在远程使用root账户登录,密码为123456
mysql> GRANT ALL ON *.* TO 'root'@'%';  # 授权
mysql> ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY '123456';
mysql> FLUSH PRIVILEGES;  # 刷新

.

posted @ 2020-02-09 12:30  每天都要进步一点点  阅读(204)  评论(0编辑  收藏  举报