[root@VM_0_12_centos ~]# service mysqld start
Starting mysqld (via systemctl): 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的日志mysqld.log后发现问题:
2018-10-23T09:42:52.392948Z 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
2018-10-23T09:42:52.393850Z 0 [Note] InnoDB: 96 redo rollback segment(s) found. 96 redo rollback segment(s) are active.
2018-10-23T09:42:52.393864Z 0 [Note] InnoDB: 32 non-redo rollback segment(s) are active.
2018-10-23T09:42:52.394308Z 0 [Note] InnoDB: Waiting for purge to start
2018-10-23T09:42:52.444451Z 0 [Note] InnoDB: 5.7.12 started; log sequence number 2548684
2018-10-23T09:42:52.444914Z 0 [Note] Plugin 'FEDERATED' is disabled.
2018-10-23T09:42:52.446421Z 0 [Note] Found ca.pem, server-cert.pem and server-key.pem in data directory. Trying to enable SSL support using them.
2018-10-23T09:42:52.446615Z 0 [Warning] CA certificate ca.pem is self signed.
2018-10-23T09:42:52.448187Z 0 [Note] Server hostname (bind-address): '*'; port: 3306
2018-10-23T09:42:52.448215Z 0 [Note] IPv6 is available.
2018-10-23T09:42:52.448223Z 0 [Note] - '::' resolves to '::';
2018-10-23T09:42:52.448235Z 0 [Note] Server socket created on IP: '::'.
2018-10-23T09:42:52.448436Z 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
2018-10-23T09:42:52.449223Z 0 [Note] InnoDB: Buffer pool(s) load completed at 181023 17:42:52
2018-10-23T09:42:52.455181Z 0 [ERROR] /usr/sbin/mysqld: Can't create/write to file '/var/run/mysqld/mysqld.pid' (Errcode: 2 - No such file or directory)
2018-10-23T09:42:52.455194Z 0 [ERROR] Can't start server: can't create PID file: No such file or directory
2018-10-23T09:42:52.498226Z mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
解决办法:
[root@VM_0_12_centos ~]# mkdir /var/run/mysqld
[root@VM_0_12_centos ~]# chown mysql.mysql /var/run/mysqld/
最后重启mysql:
[root@VM_0_12_centos ~]# service mysqld start
最后重启成功
坑多多其修远兮,吾将上下而求索。