The mysql login encountered an ERROR 1045 problem resolution

  • 2020-05-15 02:24:09
  • OfStack

On the Windows system, mysql logged in with an error like this: ERROR 1045: Access denied for user: 'root @localhost '(Using password: YES)

I found some solutions from the Internet and finally got the solution. Now I will record the specific solutions as follows:

c:\>sc stop mysql 
c:\>mysqld --defaults-file="C:\MySQL\MySQLServer6.0\my.ini" --console --skip-grant-tables 

Open 1 cmd again

c:\>mysql -uroot -p 
enter password: <-  enter  
mysql>UPDATE user SET Password=PASSWORD('newpassword') where USER='root'; 
mysql>FLUSH PRIVILEGES; 
mysql>quit 

Related articles: