mysql 8.0 登录报错

新安装mysql 8.0,在用户登录时提示这样的错误

Failed to connect to MySQL server: Authentication plugin 'caching_sha2_password' cannot be loaded: /usr/lib64/xtrabackup/plugin/caching_sha2_password.so: cannot open shared object file: No such file or directory.

在网上搜了下,发现主要是因为mysql 8.0的默认认证方式有了调整,需要做如下调整。

修改默认认证方式

# vi /etc/my.cnf

[mysqld]
default_authentication_plugin = mysql_native_password

修改已有用户的认证方式


mysql> select user,host,authentication_string,plugin,account_locked from mysql.user;

mysql> alter user 'root'@'192.168.56.%' identified with mysql_native_password by 'MyNewPass@123' PASSWORD EXPIRE NEVER;
Query OK, 0 rows affected (0.39 sec)

caching_sha2_password、mysql_native_password

下面的问题源自mysql 官方文档
Important
In MySQL 8.0, caching_sha2_password is the default authentication plugin rather than mysql_native_password. For information about the implications of this change for server operation and compatibility of the server with clients and connectors, see caching_sha2_password as the Preferred Authentication Plugin.

参考:
https://dev.mysql.com/doc/refman/8.0/en/caching-sha2-pluggable-authentication.html

posted @ 2018-08-03 16:00  peiybpeiyb  阅读(508)  评论(0编辑  收藏  举报