發生原因:安裝phpMyAdmin後,密碼異動所致,結果出現#1045 error message
解決方式:# mysql -uroot -p
Enter password:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
# mysql
ERROR 1045 (28000): Access denied for user 'mysql'@'localhost' (using password: NO)
解釋:沒有ROOT密碼權限。
(網路爬文ERROR 1045 (28000): Access denied for user 'mysql'@'localhost' (using password: NO) ,是因為如果沒有修改pid的路徑,這裡根本登入不進去,何談修改密碼。因為mysql始終無法創建pid文件)解決方式如下:
/etc/init.d/mysql stop ( 或service mysqld stop )
/usr/bin/mysqld_safe --skip-grant-tables
再開一個SSH
# mysql
mysql>use mysql
mysql>update user set password=password("1234") where user="root";
mysql>flush privileges;
mysql>exit
接者
# ps -aux | grep mysql
1234 pts/0 00:00:00 mysqld_safe
5678 pts/0 00:00:00 mysqld
[mysql@localhost etc]$ kill -9 1234 5678
啟動MySQL:/etc/init.d/mysql start (或service mysqld start)