用docker構建mysql容器後連接遇到以下問題
問題Authentication plugin 'caching_sha2_password' cannot be loaded: dlopen(/usr/local/mysql/lib/plugin/caching_sha2_password.so, 2): image not found
解決方法進入mysql容器中
$ mysql -u root -pmysql> use mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> SELECT Host, User, plugin from user;
+-+---+---+
| Host | User | plugin |
+-+---+---+
| % | root | caching_sha2_password |
| localhost | mysql.infoschema | caching_sha2_password |
| localhost | mysql.session | caching_sha2_password |
| localhost | mysql.sys | caching_sha2_password |
| localhost | root | caching_sha2_password |
+-+---+---+
5 rows in set (0.00 sec) 修改身份驗證類型(修改密碼為123456)mysql> ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY '123456';
Query OK, 0 rows affected (0.00 sec)
mysql> ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '123456';
Query OK, 0 rows affected (0.01 sec)刷新緩存mysql> FLUSH PRIVILEGES;驗證是否生效mysql> SELECT Host, User, plugin from user;
+-+---+---+
| Host | User | plugin |
+-+---+---+
| % | root | mysql_native_password |
| localhost | mysql.infoschema | caching_sha2_password |
| localhost | mysql.session | caching_sha2_password |
| localhost | mysql.sys | caching_sha2_password |
| localhost | root | mysql_native_password |
+-+---+---+
5 rows in set (0.00 sec)問題解決---