Error 1251 is reported when connecting with Navicat, as shown in the figure below:
reason
The encryption rule of versions after MySQL8.0 is "caching_sha2_password", while the encryption rule of versions before MySQL8.0 is "mysql_native_password"
Solution
Change the encryption rules and restore the MySQL user login password encryption rules to "mysql_native_password".
Let’s start the specific operation
1. Run cmd as an administrator and enter the bin directory of MySQL;
2 Enter the command "mysql -u root -p" and enter the password to enter mysql, as shown in the figure below:
3. Modify the encryption rules first, such as the command: [ ALTER USER 'root'@'localhost' IDENTIFIED BY 'password' PASSWORD EXPIRE NEVER;
] as shown in the figure below:
4. Change the password, because the encryption rules have been modified, so you need to re-enter Set the password, the command is: [ ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '新的密码';
] as shown in the figure below:
5. Finally, refresh the database, the command is: [ FLUSH PRIVILEGES;
], as shown in the figure below:
then use Navicat to succeed.
Notice
localhost is the IP of MySQL service, which needs to be filled in according to the actual installation location of MySQL.
Method Two
enter
> ALTER USER 'root' @'localhost' IDENTIFIED WITH caching_sha2_password BY '123456' ;
> SELECT plugin FROM mysql.user WHERE User = 'root';
Note: Here "123456" is your mysql password
As shown in the figure, it indicates success:
Method 2 self-test, I succeeded with method 1.