PHP连接mysql8.0出错“SQLSTATE[HY000] [2054] The server requested authentication method unkno…

 

 

Installation campus today a scream push O2O system on the server connection is not hard to say.

Below are instructions for installing, I directly 3 steps to import the database configuration file, the results show the contents of an error topic

Installation instructions: directly entering the program directory to HTTP: // localhost / root directory of the site only supports 
installation instructions:
 1 . Jump less installation directory 
delete config / install. Lock 
2 installation appears the TEMP /. Caches can not write TIP 
View directory exists, does not exist, create 
settings directory has read and write permissions 
3 . can not be installed properly, has been stuck in the installation interface 
can be imported directly install /xyo2o.sql, create config / install. Lock , change the config / config.php configuration database 
backend the default password if it is not empty admind admin admin table 
4 . Turn off access to global variables appear 
set in php.ini register_globals = OFF
 5 . open site 
, please delete the .htaccess file, or pseudo-static configuration

 

Then row is good too. Originally, I searched and searched installed mysql is 8.0

Error Messages

SQLSTATE[HY000] [2054] The server requested authentication method unknown to...

 

This error may be the default mysql  caching_sha2_password
as the default authentication plug-in, instead of  mysql_native_password
, but the client does not support this plug caused. Official documentation

In MySQL 8.0, caching_sha2_password is the default authentication plugin rather than mysql_native_password. For information about the implications of this change for server operation and compatibility of the server with clients and connectors, see caching_sha2_password as the Preferred Authentication Plugin.

In MySQL 8.0 in, caching_sha2_password is the default authentication plug-in, rather than mysql_native_password. About this change impact on server operation and compatibility information with the server and the client connector, see caching_sha2_password validation plugin as the preferred status.

Solution one: Modify the MySQL global profile

Edit  my.cnf
the file, change the default authentication plug-ins.

we /etc/my.cnf

 

In  [mysqld]
adding the following code

default_authentication_plugin=mysql_native_password

 

Then restart the mysql

 service mysqld restart

 

Solution two: Change password authentication

ALTER USER 'YOURUSERNAME'@'localhost' IDENTIFIED WITH mysql_native_password BY 'YOURPASSWORD';

 

The first method I tried not, I use the modified password authentication success. Modify and then create a database of what to Home server connection error will not fail. Fortunately, after I modify the configuration file directly into the database this specific error her to appear.

 

Reference Links: https://www.colabug.com/3497990.html

Reference link: https: //www.lanrenzhijia.com/source/5299.html

 

Guess you like

Origin www.cnblogs.com/Crazy-Liu/p/10944467.html