即使我重新用下面的命令root密碼無法登錄到MySQL:(上市提供額外的信息等命令)無法啓動mysql
# sudo dpkg-reconfigure mysql-server-5.1
# mysql -u root -p
Enter password:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
# telnet 127.0.0.1 3306
Trying 127.0.0.1...
telnet: Unable to connect to remote host: Connection refused
# ps -Aw |grep mysql
26522 ? 00:00:00 mysqld
# /etc/init.d/mysql start
Rather than invoking init scripts through /etc/init.d, use the service(8)
utility, e.g. service mysql start
Since the script you are attempting to invoke has been converted to an
Upstart job, you may also use the start(8) utility, e.g. start mysql
更新:
# sudo mysqladmin -u root password 123
mysqladmin: connect to server at 'localhost' failed
它似乎MySQL沒有正常運行
更新: 我在Ubuntu下使用MySQL 5.1。 直到我在my.cnf中進行一些更改以啓用遠程訪問才行。我撤銷了我的更改,但問題沒有解決! (也許我忘了取消某些東西!)
更新:
# service mysql status
mysql start/running, process 26650
# /etc/init.d/mysql status
Rather than invoking init scripts through /etc/init.d, use the service(8)
utility, e.g. service mysql status
Since the script you are attempting to invoke has been converted to an
Upstart job, you may also use the status(8) utility, e.g. status mysql
mysql start/running, process 26650
使用mysqladmin命令創建root密碼 – kappa 2012-04-10 13:32:33
對不起,我遲到的反應 - 如果你還沒有固定的問題是,試圖發佈您的my.cnf文件(當然沒有敏感信息)。如果您在遠程訪問時玩遊戲,可以想象,本地訪問被意外禁用。還可以考慮將日誌記錄添加到my.cnf文件中以更好地瞭解發生了什麼(通過'log-error =/var/log/mysqld.log')。 – Matthematics 2012-04-17 17:02:40
@Lübnah謝謝,我決定重新安裝MySQL。但是,本地訪問如何被禁用? – PHPst 2012-04-18 03:10:31