[Error 1251 when Navicat connects to MySQL: The client does not support the authentication protocol requested by the server; please consider upgrading the MySQL client]

Error 1251 is reported when connecting with Navicat, as shown in the figure below:
insert image description here

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:
insert image description here
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:
insert image description here
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:
insert image description here
5. Finally, refresh the database, the command is: [ FLUSH PRIVILEGES;], as shown in the figure below:
insert image description here
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:

insert image description here

Method 2 self-test, I succeeded with method 1.

Guess you like

Origin blog.csdn.net/m0_66106755/article/details/130726727