即使我重新用下面的命令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