- 執行 mysql -uroot -ppassword 出現以下錯誤
ERROR 1045 (28000): Access denied for user 'root'@'localhost'
- 中止mysql
# service mysql stop //or # /usr/local/mysql/support-files/mysql.server stop
- 安全模式啓動
//找到mysqld_safe所在位置 # find /usr/local/mysql -name "mysqld_safe" # mysqld_safe --skip-grant-tables --skip-networking &
- 安全模式進入mysql
# mysql -u root //password替換爲你要修改的密碼 mysql> UPDATE mysql.user SET PASSWORD=PASSWORD('password') WHERE USER='root';
- 啓動mysql,問題解決
# service mysql start //or # /usr/local/mysql/support-files/mysql.server start