Recently, I needed to use a database when learning Django, so I downloaded navicat to be used with mysql, but the following problems did occur when connecting:
After searching online, I found that the reason for this error is that the encryption rule in versions before mysql8 is mysql_native_password, while the encryption rule after mysql8 is caching_sha2_password.
Related recommendations: "Navicat for mysql graphic tutorial"
There are two ways to solve this problem, one is to update the navicat driver to solve this problem, the other is The first is to change the encryption rule for mysql user login to mysql_native_password.
The second method was adopted based on most suggestions on the Internet:
1. Open cmd with administrator rights, 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; #刷新数据
Under normal circumstances, you can continue to use navicat to connect to mysql successfully. However, I died in the first step and could not enter the database. ;
I don’t know if anyone like me has encountered this situation, but don’t panic, cmd is not allowed 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 What should I do if navicat connection error 2059 is reported?. For more information, please follow other related articles on the PHP Chinese website!