還有,輸mysql可以,輸mysql -u root就出錯了:
Access denied for user 'root'@'localhost' (using password: NO).

The reason is:
是昨日更新ROOT密碼時出錯
update user set password = '123456' where user ="root" //這樣寫是錯的,密碼其實不是123456
應該為update user set password = password ('123456') where user = "root"

具體操作步驟:
關閉mysql:
# service mysqld stop
然後:
# mysqld_safe --skip-grant-tables
啟動mysql:
# service mysqld start
mysql -u root
mysql> use mysql
mysql> UPDATE user SET Password=PASSWORD('xxx') WHERE user='root';
mysql> flush privileges;
mysql>/q

原文內容:http://bbs.linuxpk.com/thread-22953-1-6.html

感謝Suse

.