2

即使在我使用以下命令重置 root 密码后,我也无法登录 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
4

5 回答 5

2

设置root密码:

 mysqladmin -u root password NEWPASSWORD

要恢复它: http ://www.cyberciti.biz/tips/recover-mysql-root-password.html

于 2012-04-10T13:33:43.073 回答
2

我最好的猜测是,如果您重新配置/重新安装了 MySQL,则需要不使用密码登录,例如:

mysql -u root

甚至

mysql


编辑:要查看服务是否正在运行,您可以尝试:

service mysqld status

如果它没有运行,请尝试:

service mysqld start然后再次检查状态。

于 2012-04-10T13:34:25.433 回答
1

作为服务启动

sudo 服务 mysql 重启

验证和检查服务和端口

sudo netstat -tap | grep mysql

检查mysql服务运行的截图

于 2013-02-06T04:51:57.513 回答
1

似乎 MySQL 肯定没有运行。/etc/init.d/mysqld status您可以使用or来验证这一点service mysqld status(不要直接链接到 service 命令)。

我的蜘蛛侠感觉告诉我您的 O/S 或 MySQL 安装执行不正确。了解更多关于您正在运行的(linux?)环境以及它是如何配置的(或谁配置它,在 PaaS 的情况下)的信息将非常有帮助。

于 2012-04-10T14:27:45.893 回答
0

您应该更改访问权限。应该是 0644

sudo chmod 644  /etc/mysql/my.cnf

接着

sudo dpkg-reconfigure mysql-server-5.5
于 2013-11-13T05:19:19.440 回答