nodejs mysql database connection, an error Client does not support authentication protocol requested by server solution

I am here and MYSQL version is 8.0, the database code as follows

 

 

 Run the code, the result of an error

 

 Internet search a bit and found that mysql is an updated version of the problem, the solution is as follows:

Mysql in the root directory of the unpacked, I have here is C: \ Program Files \ MySQL \ MySQL Server 8.0, hold down the shift key + right-click to run the command line window

 

 

 

 

 Then enter: MySQL-uroot--pq791469353 , and then press Enter (-u is the database username, -p is the password, I have here is q791469353)

 

 After entering the database, and then enter: the ALTER the USER 'the root' @ 'localhost' the WITH mysql_native_password the IDENTIFIED BY 'q791469353'; can, and then press ENTER

 

 The semicolon is a must!

Enter FLUSH PRIVILEGES; can, pressing the Enter key.

If there is a mysql is not recognized because there is no path to mysql add to the system environment variables, copy bin path in mysql, I have here is C: \ Program Files \ MySQL \ MySQL Server 8.0 \ bin

Then right-click My Computer , and then click

 

 Click on Advanced System Settings,

 

 Click the environment variable,

 

 Select Path In the first step, select Edit

 

 Add the path to the environment variable can be, you should add two Path!

 

Guess you like

Origin www.cnblogs.com/Liqian-Front-End-Engineer/p/11571646.html