解决mysql-8.0.18 ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

Since the mysql version of the update, when faced with this problem in many ways not fully use the Internet to search, so that the recording current solution mysql-8.0.18 ERROR 1045 (28000): Access denied for user 'root' @ 'localhost' ( using password: YES) method.

 

solution:

 

1. shortcut windows + R; enter services.msc; find MySQL to stop its services

 

2. At the command line in the program; cmd attention to the need to run a program with administrator privileges, otherwise it can not close the mysqld process

>> tasklist | findstr mysqld command line can be used to view mysqld is running, it can be found in the operation of its PID

>> taskkill / F / PID xxxx xxxx is get a command from the previous PID value

 

3. Skip permission to log MySQL server

Performing mysqld --console --skip-grant-tables --shared-memory in cmd

 

 

At this point the program will be blocked cmd, and then re-close the cmd program with administrator privileges to run cmd

Then enter the cmd command line mysql able to connect a MySQL server

 

4. No password

mysql -u root -p 
   Press Enter to enter

 

5. Change Password

use mysql;
    select user,host,authentication_string from user;
    ### 密码设置为空
    update user set authentication_string='' where user='root';

     flush privileges;
     quit;

Guess you like

Origin www.cnblogs.com/blzm742624643/p/12130186.html