navicat reports error 2059 when connecting to mysql, as shown in the figure below:
After online query, I found that the reason for this error is The encryption rule in versions before mysql8 is mysql_native_password, while the encryption rule after mysql8 is caching_sha2_password.
There are two ways to solve this problem. One is to update the navicat driver to solve this problem, and the other is to change the encryption rule for mysql user login to mysql_native_password.
Related recommendations: "Navicat for mysql graphic tutorial"
The second method was adopted based on most suggestions on the Internet:
1. Open cmd with administrator privileges, enter mysql -u root -p to enter the password and enter the mysql database;
mysql -u root -p #进入数据库
2. Modify the encryption rules and password and refresh;
ALTER USER 'root'@'localhost' IDENTIFIED BY '你的mysql密码' PASSWORD EXPIRE NEVER; #修改加密规则 ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '你的mysql密码'; #修改密码 FLUSH PRIVILEGES; #刷新数据
Normal situation Continue to use navicat to connect to mysql and it will be successful. However, I died in the first step and could not enter the database;
I don’t know if there are friends like me. If you encounter this situation, don't panic. The cmd will not allow you to enter. We can log in directly with mysql client;
Enter the password, enter mysql, and enter the command in the second point to solve the problem.
The above is the detailed content of How to solve error 2059 when navicat connects to mysql. For more information, please follow other related articles on the PHP Chinese website!