【MySQL8】ERROR 2059 (HY000): Authentication plugin 'caching_sha2_password' cannot be loaded:
mysql8.0.24初始化,并启动数据库实例之后,登录mysql shell提示报错
$ mysql -uroot -p'xxx' -S /data/mysql_3308/tmp/mysql.sock
mysql: [Warning] Using a password on the command line interface can be insecure.
ERROR 2059 (HY000): Authentication plugin 'caching_sha2_password' cannot be loaded: /usr/local/mysql/lib/plugin/caching_sha2_password.so: cannot open shared object file: No such file or directory
修改参数my.cnf,新增default_authentication_plugin=mysql_native_password
依然,不能登录mysql shell
最后,发现由于采用mysql5.7的安装包bin目录下的mysql可执行文件造成的。
$ ./mysql8/bin/mysql -uroot -p'jJf<roTb?9og' -S /data/mysql_3308/tmp/mysql.sock
mysql> ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'root';
Query OK, 0 rows affected (0.01 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql>