重置root用户密码后,无法在CentOS 7上重启MySQL

时间:2016-04-26 07:41:54

标签: mysql centos lamp

我已使用以下步骤重置MySQL root用户密码

  1. 停止MySQL
  2. # systemctl stop mysqld

    1. 启动安全模式
    2. # mysqld_safe --skip-grant-tables &

      1. 以root身份登录
      2. # mysql -u root

        1. 重置密码
        2. use mysql;

          update user set password=PASSWORD("newpassword") WHERE user='root';

          flush privileges;

          quit;

          1. 停止MySQL安全模式
          2. # systemctl stop mysqld

            1. 启动MySQL
            2. # systemctl start mysqld

              尝试重新启动时收到以下消息

              # systemctl restart mysqld

              Job for mysqld.service failed because the control process exited with error code. See "systemctl status mysqld.service" and "journalctl -xe" for details.
              
              [root@li1456-180 ~]# systemctl status mysqld.service
              
              ● mysqld.service - MySQL Community Server
              
                 Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)
              
                 Active: failed (Result: start-limit) since Tue 2016-04-26 07:23:19 UTC; 10s ago
              
                Process: 13293 ExecStartPost=/usr/bin/mysql-systemd-start post (code=exited, status=0/SUCCESS)
              
                Process: 13292 ExecStart=/usr/bin/mysqld_safe (code=exited, status=1/FAILURE)
              
                Process: 13280 ExecStartPre=/usr/bin/mysql-systemd-start pre (code=exited, status=0/SUCCESS)
              
               Main PID: 13292 (code=exited, status=1/FAILURE)
              
              Apr 26 07:23:18 li1456-180.members.linode.com systemd[1]: Failed to start MySQL Community Server.
              
              Apr 26 07:23:18 li1456-180.members.linode.com systemd[1]: Unit mysqld.service entered failed state.
              
              Apr 26 07:23:18 li1456-180.members.linode.com systemd[1]: mysqld.service failed.
              
              Apr 26 07:23:19 li1456-180.members.linode.com systemd[1]: mysqld.service holdoff time over, scheduling restart.
              
              Apr 26 07:23:19 li1456-180.members.linode.com systemd[1]: start request repeated too quickly for mysqld.service
              
              Apr 26 07:23:19 li1456-180.members.linode.com systemd[1]: Failed to start MySQL Community Server.
              
              Apr 26 07:23:19 li1456-180.members.linode.com systemd[1]: Unit mysqld.service entered failed state.
              
              Apr 26 07:23:19 li1456-180.members.linode.com systemd[1]: mysqld.service failed.
              

              我错过了什么吗?

1 个答案:

答案 0 :(得分:0)

我非常确定答案是tail -f /var/log/messages | grep -i mysql

在另一个终端上:

systemctl restart mysqld

重启mysql

$doc

检查日志并找到错误,如果仍然无法解决,请发布,以便我们为您提供更多帮助。