天天看點

Access denied for user ‘root‘@‘localhost‘ (using password: YES”的處理方法)

登入MySQL時報錯

解決辦法:

# /etc/init.d/mysqld stop 

# mysqld_safe --user=mysql --skip-grant-tables --skip-networking & 

# mysql -u root mysql 

mysql> UPDATE user SET Password=PASSWORD(’newpassword’) where USER=’root’; 

mysql> FLUSH PRIVILEGES; 

mysql> quit 

# /etc/init.d/mysqld restart 

# mysql -uroot -p 

Enter password: <輸入新設的密碼newpassword> 

mysql> 
           

quit後可kill progress殺死程序,重新開啟終端啟動MySQL