启动mysql服务的时候一直报ERROR! The server quit without updating PID file

问题背景

        最近在电脑的vmware上安装了个CentOS 7系统,并在系统中装了mysql-8.0.11,可是启动服务的时候一直报错,如下

[root@localhost etc]# service mysql start
Starting MySQL... ERROR! The server quit without updating PID file  (/usr/local/mysql/data/localhost.localdomain.pid).

[root@localhost etc]# service mysql start
Starting MySQL... ERROR! The server quit without updating PID file (/usr/local/mysql/data/localhost.localdomain.pid).

解决方法

        在网上找了很多方法都不行,最后在 /etc/init.d 这个目录下的mysql文件中加了--user=root 参数,就解决了,具体操作如下:

  1. 打开如下目录/etc/init.d,找到mysql文件
    [root@localhost init.d]# pwd
    /etc/init.d
    [root@localhost init.d]# ll
    总用量 64
    -rw-r--r--. 1 root root  17500 5月   3 2017 functions
    -rwxr-xr-x  1  777 mysql 10588 12月  7 12:50 mysql
    -rwxr-xr-x. 1  777 mysql 10576 4月   8 2018 mysqld
    -rwxr-xr-x. 1 root root   4334 5月   3 2017 netconsole
    -rwxr-xr-x. 1 root root   7293 5月   3 2017 network
    -rw-r--r--. 1 root root   1160 8月   5 2017 README
    [root@localhost init.d]#
  2. 用vi命令打开mysql进行编辑输入:set nu显示出行号,继续输入/mysqld_safe 查找文件中mysqld_safe的位置,按n键查找下一个,我的是在266行找到$bindir/mysqld_safe 在后面加上一句--user=root并保存退出:wq!,如下图所示:
  3. 重新执行service mysql start启动服务  SUCCESS!!!
[root@localhost mysql]# service mysql start
Starting MySQL....... SUCCESS! 

---------------有问题请留言---------------

猜你喜欢

转载自blog.csdn.net/weixin_42258633/article/details/128218428