连接mysql8数据库时,报错。
Plugin caching_sha2_password could not be loaded: …/plugins/libmariadb/caching_sha2_password.so: cannot open shared object file: No such file or directory
解决方法:
select Host,User,plugin from mysql.user;
alter user root@localhost identified with mysql_native_password by ‘root123’;
FLUSH PRIVILEGES;
`
select Host,User,plugin from mysql.user;
alter user root@localhost identified with mysql_native_password by ‘root123’;
FLUSH PRIVILEGES;
`
本机连接还是报错,把连接串中的ip地址127.0.0.1换成localhost,又出现如下错误。
Can’t connect to local server through socket ‘/tmp/mysql.sock’
找一下这个文件
find / -name mysql.sock
加个软连接
ln -s /home/mysql/data/mysql.sock /tmp/mysql.sock
还是没有解决。原因可以参考https://blog.51cto.com/zhangxueliang/4953555
最后修改了root的访问权限
alter user ‘root’@‘%’ identified with mysql_native_password by ‘root123’;
FLUSH PRIVILEGES;
可成功访问。但是降低了安全性,有违初衷。