Authentication plugin ‘caching_sha2_password‘ cann

在docker容器中连接mysql正常,在宿主机上连接docker容器中的mysql报错:

ERROR 2059 (HY000): 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

进入容器:

docker exec -it mysql8 /bin/bash

连接上msyql并执行修改登录验证策略:

# mysql -uroot -p 
Enter password: 

mysql> ALTER USER 'root'@'%' IDENTIFIED BY 'password' PASSWORD EXPIRE NEVER;
Query OK, 0 rows affected (0.01 sec)

mysql> ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY 'password';
Query OK, 0 rows affected (0.01 sec)

mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)

mysql> exit

再次在宿主机上尝试连接就可以连接成功了.

发表回复

京ICP备15027918号-1