mysql8 Public Key Retrieval is not allowed

mysql8 之后,用户的密码验证改为caching_sha2_password,MySQL5.7及之前为mysql_native_password。

方法一:

登录MySQL后输入:

ALTER USER ‘your user name’@’your host’ IDENTIFIED WITH mysql_native_password BY ‘YourPassword’;

FLUSH PRIVILEGES;

方法二:

编辑my.cnf文件,更改默认的身份认证插件。

vi /etc/my.cnf

在[mysqld]中添加下边的代码
default_authentication_plugin=mysql_native_password

然后重启MySQL

发表评论

邮箱地址不会被公开。 必填项已用*标注