php error 2054 when connecting to mysql?
The reason why this happens is mainly because of mysql8.0 version. The default encoding of version 8.0 is utf8mb4
Solution:
Add these two lines under [mysqld] in the MySQL configuration file my.ini
1 |
|
Then another problem appeared:
1 |
|
It is also due to the mysql version, the 8.0 version mysql account The password unlocking mechanism is inconsistent
Enter the command in the database operation interface
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'account password';
That's it
Or add
1 |
|
under [mysqld] in the MYSQL configuration file my.iniz. For more PHP related knowledge, please visit PHP Chinese website!
The above is the detailed content of php connects to mysql and reports error 2054. For more information, please follow other related articles on the PHP Chinese website!