先上错误提示:
Failed to Connect to MySQL at 10.211.55.6:3306 with user root
Authentication plugin 'caching_sha2_password' cannot be loaded: dlopen(/usr/local/mysql/lib/plugin/caching_sha2_password.so, 2): image not found
意思是说加密方式客户端不支持,通过终端进入数据库,并查看一下用户密码的加密方式
mysql>use mysql;
mysql>select user, host, plugin, authentication_string from user\G;
结果:
user: root
host: %
plugin: caching_sha2_password
果然 root 的密码是用 caching_sha2_password 插件加密的。而客户端找不到 caching_sha2_password 插件,于是登录不上。
新增一个用户:
mysql>CREATE USER 'test'@'%' IDENTIFIED WITH mysql_native_password BY 'test';
发现是可以链接成功的,但是需要授权,那就试试修改一下root用户的密码和加密方式:
mysql>ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY 'root';
好了,链接成功!