报错信息:
今天安装部署mysql二进制数据库是8.0版本,服务端启动成功后,试着连mysql,结果报错
$ mysql -h127.0.0.1 -P3306 -uroot -p
Enter password:
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
查看mysql命令
$ which mysql
/bin/mysql
引用的是系统的mysql的客户端,不是我刚安装的mysql
尝试使用当前目录下的客户端连接,可以成功
$ ./mysql -h127.0.0.1 -P3306 -uroot -p
那么问题就好办了,在环境变量加入
解决方案:
$ vim ~/.bash_profile
export MYSQL_HOME=$HOME/3rd/mysql8
export PATH=$MYSQL_HOME/bin:$PATH
export LD_LIBRARY_PATH=$MYSQL_HOME/lib:$LD_LIBRARY_PATH
生效环境变量
$ source ~/.bash_profile
连接数据库
$ ./mysql -h127.0.0.1 -P3306 -uroot -p
成功。
其他机器老客户端
建议升级mysql客户端,这里写了篇教程。

欢迎关注我的公众号testerzhang,原创技术文章第一时间推送。
网友评论