Access denied for user 'mysql'@'localhost' (using password: YES) # /etc/int.d/mysql stop <首先要中止你以前的啓動的mysql.若是中止的時候.也出現1045的錯誤的話那只有kill掉mysql的pid> # mysqld_safe --user=mysql --skip-grant-tables --skip-networking & # mysql -u root mysql> use mysql mysql> UPDATE user SET Password=PASSWORD('newpassword') where USER='root'; mysql> FLUSH PRIVILEGES; mysql> quit # /etc/init.d/mysql start # mysql -uroot -p Enter password: <輸入新設的密碼newpassword>