启动mysql Job for mysqld.service failed because the control process exited with error code. See "syste

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/ypp91zr/article/details/82965406

今天你重启linux后,启动mysql一直报错 Job for mysqld.service failed because the control process exited with error code. See "systemctl status mysqld.service" and "journalctl -xe" for details.
                                                           [FAILED]

然后去查看mysql启动日志,无奈太多行。

查看最后20行:tail -n 20  /var/log/mysqld.log

错误如下:

2018-10-08T02:54:57.635255Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
2018-10-08T02:54:57.686614Z 0 [Note] InnoDB: Completed initialization of buffer pool
2018-10-08T02:54:57.715292Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
2018-10-08T02:54:57.728284Z 0 [Note] InnoDB: Highest supported file format is Barracuda.
2018-10-08T02:54:57.771885Z 0 [Note] InnoDB: Removed temporary tablespace data file: "ibtmp1"
2018-10-08T02:54:57.771922Z 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2018-10-08T02:54:57.772052Z 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2018-10-08T02:54:58.021555Z 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
2018-10-08T02:54:58.022600Z 0 [Note] InnoDB: 96 redo rollback segment(s) found. 96 redo rollback segment(s) are active.
2018-10-08T02:54:58.022624Z 0 [Note] InnoDB: 32 non-redo rollback segment(s) are active.
2018-10-08T02:54:58.023805Z 0 [Note] InnoDB: 5.7.23 started; log sequence number 190663054
2018-10-08T02:54:58.023982Z 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
2018-10-08T02:54:58.024119Z 0 [Note] Plugin 'FEDERATED' is disabled.
2018-10-08T02:54:58.031317Z 0 [Note] Found ca.pem, server-cert.pem and server-key.pem in data directory. Trying to enable SSL support using them.
2018-10-08T02:54:58.031664Z 0 [Warning] CA certificate ca.pem is self signed.
2018-10-08T02:54:58.033871Z 0 [Note] Server hostname (bind-address): '*'; port: 3306
2018-10-08T02:54:58.034201Z 0 [Note] IPv6 is available.
2018-10-08T02:54:58.034214Z 0 [Note]   - '::' resolves to '::';
2018-10-08T02:54:58.034243Z 0 [Note] Server socket created on IP: '::'.
2018-10-08T02:54:58.041954Z 0 [ERROR] Can't start server: can't check PID filepath: No such file or directory

最主要是最后一行错误

MySQL服务在启动的时候,不能创建pid文件。

在终端看一下该目录是否存在,果然,不存在。

于是,创建了/var/run/mysqld/目录,重启MySQL服务

mkdir -p /var/run/mysqld/

/etc/init.d/mysqld start

依旧报错

原来,/var/run/mysqld/的属主和属组还是root,mysql并不能在其中创建文件,后修改该目录的属主和属组,启动OK

[root@ebs-46753 /]# ls -ld /var/run/mysqld/
drwxr-xr-x. 2 root root 40 10月  8 11:07 /var/run/mysqld/
[root@ebs-46753 /]# chown mysql.mysql /var/run/mysqld/
[root@ebs-46753 /]# cd
[root@ebs-46753 ~]# service mysqld start
Starting mysqld (via systemctl):                           [  OK  ]
[root@ebs-46753 ~]# 
 

猜你喜欢

转载自blog.csdn.net/ypp91zr/article/details/82965406