nodeJS MySQL 连接报错Client does not support authentication protocol requested by server; consider upgra

Scenario:MySQL database is used under the nodeJs express framework. It is normal to set up MySQL. Because I changed the default port of MySQL from 3306 to 3307, which caused a series of errors~< /span>

When establishing the link here, port: 3307 is specially added, otherwise it will default to port 3306 for connection. 

 After the parameters are correct, an error still occurs

问题:报错Client does not support authentication protocol requested by server; consider upgrading MySQL client

The Chinese meaning is: The client does not support the authentication protocol requested by the server. Consider upgrading the mysql client.

The fundamental reason here is that you have installed MySQL version 8.0 or above. The password encryption method has changed, so lower versions of Navicat cannot adapt automatically. So the simple method is to upgrade the Navicat client, or manually modify the password rules.

 Solution:

method one:

Download the new version of navicat for mysql

Method Two:

1. Find your MySQL installation path and enter the bin directory

2. Enter cmd in the address bar to enter the command line

 3. Enter the command mysql -u root -p and press Enter

4. Enter your password and press Enter 

 

 5. If your port is the default 3306, you can ignore this paragraph and look directly at the serial number 7; because it is not 3306, I reported an error.

6. Need to change a statement: mysql -u root -P 3307 -h 127.0.0.1 -p Enter

Where you fill in 3307 is your port number. Then continue to enter your password and press Enter

7. Then enter the two commands in sequence

  • The last root here is your modified password, change it according to your needs 
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'root'; 
  •  Refresh permissions
FLUSH PRIVILEGES; 

 Done, just reconnect and try again~

Reference article:Navicat reports error 1251Client does not support authentication protocol requested by server when creating a new connection Solution - Zhihu

Guess you like

Origin blog.csdn.net/qq_58340302/article/details/131815313