PHP version is 5.6. An error is reported when connecting to mysql8.0, but it is normal to connect to other versions before mysql8
The reason may be that mysql8 uses different password authentication methods by default, and mysql8.0 uses caching by default_sha2_Password, but previous versions used mysql_native_password
Solution:
Modify the/etc/my.cnf file
Find default authentication plugin = MySQL_native_Password line
Cancel the # number in front and restart mysql. MySQL will be used by default_native_Password, and then use the previous PHP script to test the connection to MySQL
As follows. The root user marked by the red arrow can connect normally
Similar Posts:
- [Solved] MYSQL Error: this authentication plugin is not supported
- [Solved] Deploying Tomcat connection in Linux Navicat reports error 2059 – authentication plugin ‘caching_sha2_Password ‘cannot be loaded: + Xi input 9 g
- Error in connecting to MySQL via Navicat on MAC
- MYSQL 8.0 Login Error: caching_sha2_password [How to Solve]
- [How to Solve] nodejs mysql ER_NOT_SUPPORTED_AUTH_MODE
- MySQL Connect Error: 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
- Solve the problem of unknown column ‘password’ in ‘field list’ in MySQL
- [Solved] SQLyog Connect MYSQL Error: 2058 plugin caching_sha2_password could not be loaded
- MYSQL Login Error: mysqladmin: connect to server at ‘localhost’ failed