this authentication plugin is not supported
The application keeps reporting an error when connecting to mysql docker: this authentication plugin is not supported.
I found that the new version of mysql (8.0 or above) updated the plugin used by the root user to caching_sha2_password.
Login to mysql and enter the following command to see.
mysql> select user,plugin from mysql.user;
+——————+———————–+
| user | plugin |
+——————+———————–+
| root | caching_sha2_password |
| mysql.infoschema | mysql_native_password |
| mysql.session | mysql_native_password |
| mysql.sys | mysql_native_password |
| root | caching_sha2_password |
+——————+———————–+
The solutions are.
(1) Downgrade and use an older version of mysql.
(2) Change root’s plugin to mysql_native_password.
Here change it to
ALTER USER ‘root’@’localhost’ IDENTIFIED WITH mysql_native_password BY ‘root’;
This line of code has two meanings, first: change root’s password to ‘root’, discarding the old password. Second: use mysql_native_password to encode the new password.
Then start the application again, it still reports the same error. Looking at mysql.user again, I found that there is another root user with host “%”.
mysql> select host,user,plugin from mysql.user;
+———–+——————+———————–+
| host | user | plugin |
+———–+——————+———————–+
| % | root | caching_sha2_password |
| localhost | mysql.infoschema | mysql_native_password |
| localhost | mysql.session | mysql_native_password |
| localhost | mysql.sys | mysql_native_password |
| localhost | root | mysql_native_password |
+———–+——————+———————–+
5 rows in set (0.00 sec)
Change this user as well.
ALTER USER ‘root’@’%’ IDENTIFIED WITH mysql_native_password BY ‘root ‘;
See again.
mysql> select host,user,plugin from mysql.user;
+———–+——————+———————–+
| host | user | plugin |
+———–+——————+———————–+
| % | root | mysql_native_password |
| localhost | mysql.infoschema | mysql_native_password |
| localhost | mysql.session | mysql_native_password |
| localhost | mysql.sys | mysql_native_password |
| localhost | root | mysql_native_password |
+———–+——————+———————–+
The change was successful, and when I started the application, I got the following error
This user requires mysql native password authentication
Add ?allowNativePasswords=true to the url of the mysql connection, this time it works fine.
———————
Similar Posts:
- [Solved] Deploying Tomcat connection in Linux Navicat reports error 2059 – authentication plugin ‘caching_sha2_Password ‘cannot be loaded: + Xi input 9 g
- [How to Solve] nodejs mysql ER_NOT_SUPPORTED_AUTH_MODE
- MYSQL 8.0 Login Error: caching_sha2_password [How to Solve]
- MySQL Connect Error: Authentication plugin ‘caching_sha2_password’ cannot be loaded
- ERROR 2059 (HY000): Authentication plugin ‘caching_sha2_password’ cannot be loaded
- [Solved] MYSQL 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
- How to solve the error of PHP connection to mysql8
- [Solved] ER_NOT_SUPPORTED_AUTH_Mode node connection database error
- [Solved] Ubuntu mariadb root access denied after mysql_secure_installation
- [Solved] SQLyog Connect MYSQL Error: 2058 plugin caching_sha2_password could not be loaded