Mysql 8.0.11 Authentication plugin ‘caching_sha2_password’ 处理方法

新装的mysql 8.0.11,用mydumper连接发现连接不上,总是报错:

Error connecting to database: Authentication plugin ‘caching_sha2_password’ cannot be loaded:

/usr/lib64/mysql/plugin/caching_sha2_password.so: cannot open shared object file: No such file or directory

进到数据库里面查看信息:

mysql> use mysql;
Database changed
mysql> select user, host, plugin, authentication_string from user \G
*************************** 1. row ***************************
                 user: mysql.infoschema
                 host: localhost
               plugin: mysql_native_password
authentication_string: *THISISNOTAVALIDPASSWORDTHATCANBEUSEDHERE
*************************** 2. row ***************************
                 user: mysql.session
                 host: localhost
               plugin: mysql_native_password
authentication_string: *THISISNOTAVALIDPASSWORDTHATCANBEUSEDHERE
*************************** 3. row ***************************
                 user: mysql.sys
                 host: localhost
               plugin: mysql_native_password
authentication_string: *THISISNOTAVALIDPASSWORDTHATCANBEUSEDHERE
*************************** 4. row ***************************
                 user: root
                 host: localhost
               plugin: caching_sha2_password
authentication_string: 
4 rows in set (0.03 sec) 

发现是因为”caching_sha2_password”的问题,只要改回”mysql_native_password”就可以了

修改第一步:

mysql> ALTER USER ‘root’@’localhost’ IDENTIFIED WITH mysql_native_password BY ‘root’;

修改第二步:

在my.cnf配置文件中[mysqld]内设置默认为"mysql_native_password"
# vim /etc/my.cnf
[mysqld]
default_authentication_plugin=mysql_native_password

6 评论

  1. Hello there, just became alert to your blog through Google,
    and found that it is really informative.
    I am gonna watch out for brussels. I’ll appreciate if you continue this in future.
    A lot of people will be benefited from your writing. Cheers!

留下评论

error: Content is protected !!