Error Message:
error 2059: 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
———————
Production Environment:
centos7.4 +MySQL 8.0.11
mysql> select version();
+———–+
| version() |
+———–+
| 8.0.11 |
+———–+
1 row in set (0.00 sec)
mysql> show variables like ‘default_authentication_plugin’;
+——————————-+———————–+
| Variable_name | Value |
+——————————-+———————–+
| default_authentication_plugin | caching_sha2_password |
+——————————-+———————–+
1 row in set (0.01 sec)
mysql> select host,user,plugin from mysql.user;
+———–+——————+———————–+
| host | user | plugin |
+———–+——————+———————–+
| % | root | caching_sha2_password |
| localhost | mysql.infoschema | mysql_native_password |
| localhost | mysql.session | mysql_native_password |
| localhost | mysql.sys | mysql_native_password |
| localhost | root | caching_sha2_password |
+———–+——————+———————–+
5 rows in set (0.00 sec)
The mysql default authentication is caching_sha2_password, we can change it to mysql_native_password.
#temp methods
mysql> set global default_authentication_plugin=’mysql_native_password’;
ERROR 1238 (HY000): Variable ‘default_authentication_plugin’ is a read only variable
#permanent methods
vim my.cnf
[mysqld]
default_authentication_plugin=mysql_native_password