[root@training ~]# systemctl start mysql Job for mysqld.service failed because the control process exited with error code. See "systemctl status mysqld.service" and "journalctl -xe" for details.
使用systemctl status查看狀態:
[root@training ~]# systemctl status mysql ● mysqld.service - LSB: start and stop MySQL Loaded: loaded (/etc/rc.d/init.d/mysqld; bad; vendor preset: disabled) Active: failed (Result: exit-code) since Sun 2018-05-06 10:06:53 CST; 26min ago Docs: man:systemd-sysv-generator(8) Process: 29770 ExecStart=/etc/rc.d/init.d/mysqld start (code=exited, status=1/FAILURE) May 06 10:06:52 training systemd[1]: Starting LSB: start and stop MySQL... May 06 10:06:53 training mysqld[29770]: Starting MySQL.The server quit without updating PID file (/usr/local/mysql/data/mysql/training.pid).[FAILED] May 06 10:06:53 training systemd[1]: mysqld.service: control process exited, code=exited status=1 May 06 10:06:53 training systemd[1]: Failed to start LSB: start and stop MySQL. May 06 10:06:53 training systemd[1]: Unit mysqld.service entered failed state. May 06 10:06:53 training systemd[1]: mysqld.service failed.
查找錯誤日志:
[root@training bin]# find / -name *.err /usr/local/mysql/data/mysql/training.err /usr/local/mysql/data/mysql/iZuf6cbbj56cbug03s58zrZ.err
打開較新的日志文件:
[root@training bin]# vim /usr/local/mysql/data/mysql/training.err
日志內容:
180505 18:03:39 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/data/mysql 2018-05-05 18:03:40 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details). 2018-05-05 18:03:40 0 [Note] /usr/local/mysql/bin/mysqld (mysqld 5.6.33) starting as process 28307 ... 2018-05-05 18:03:40 28307 [Note] Plugin 'FEDERATED' is disabled. /usr/local/mysql/bin/mysqld: Table 'mysql.plugin' doesn't exist 2018-05-05 18:03:40 28307 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it. 2018-05-05 18:03:40 28307 [Note] InnoDB: Using atomics to ref count buffer pool pages 2018-05-05 18:03:40 28307 [Note] InnoDB: The InnoDB memory heap is disabled 2018-05-05 18:03:40 28307 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins 2018-05-05 18:03:40 28307 [Note] InnoDB: Memory barrier is not used 2018-05-05 18:03:40 28307 [Note] InnoDB: Compressed tables use zlib 1.2.3 2018-05-05 18:03:40 28307 [Note] InnoDB: Using Linux native AIO 2018-05-05 18:03:40 28307 [Note] InnoDB: Using CPU crc32 instructions 2018-05-05 18:03:40 28307 [Note] InnoDB: Initializing buffer pool, size = 128.0M 2018-05-05 18:03:40 28307 [Note] InnoDB: Completed initialization of buffer pool 2018-05-05 18:03:40 28307 [Note] InnoDB: Highest supported file format is Barracuda. 2018-05-05 18:03:40 28307 [Note] InnoDB: 128 rollback segment(s) are active. 2018-05-05 18:03:40 28307 [Note] InnoDB: Waiting for purge to start 2018-05-05 18:03:40 28307 [Note] InnoDB: 5.6.33 started; log sequence number 2045871 2018-05-05 18:03:40 28307 [Note] Server hostname (bind-address): '*'; port: 3306 2018-05-05 18:03:40 28307 [Note] IPv6 is available. 2018-05-05 18:03:40 28307 [Note] - '::' resolves to '::'; 2018-05-05 18:03:40 28307 [Note] Server socket created on IP: '::'. 2018-05-05 18:03:40 28307 [ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.user' doesn't exist 180505 18:03:40 mysqld_safe mysqld from pid file /usr/local/mysql/data/mysql/training.pid ended 180505 18:03:51 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/data/mysql 2018-05-05 18:03:51 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details). 2018-05-05 18:03:51 0 [Note] /usr/local/mysql/bin/mysqld (mysqld 5.6.33) starting as process 28465 ... 2018-05-05 18:03:51 28465 [Note] Plugin 'FEDERATED' is disabled. /usr/local/mysql/bin/mysqld: Table 'mysql.plugin' doesn't exist 2018-05-05 18:03:51 28465 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it. 2018-05-05 18:03:51 28465 [Note] InnoDB: Using atomics to ref count buffer pool pages 2018-05-05 18:03:51 28465 [Note] InnoDB: The InnoDB memory heap is disabled 2018-05-05 18:03:51 28465 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins 2018-05-05 18:03:51 28465 [Note] InnoDB: Memory barrier is not used 2018-05-05 18:03:51 28465 [Note] InnoDB: Compressed tables use zlib 1.2.3 2018-05-05 18:03:51 28465 [Note] InnoDB: Using Linux native AIO 2018-05-05 18:03:51 28465 [Note] InnoDB: Using CPU crc32 instructions 2018-05-05 18:03:51 28465 [Note] InnoDB: Initializing buffer pool, size = 128.0M 2018-05-05 18:03:51 28465 [Note] InnoDB: Completed initialization of buffer pool 2018-05-05 18:03:51 28465 [Note] InnoDB: Highest supported file format is Barracuda. 2018-05-05 18:03:51 28465 [Note] InnoDB: 128 rollback segment(s) are active. 2018-05-05 18:03:51 28465 [Note] InnoDB: Waiting for purge to start 2018-05-05 18:03:51 28465 [Note] InnoDB: 5.6.33 started; log sequence number 2045871 2018-05-05 18:03:51 28465 [Note] Server hostname (bind-address): '*'; port: 3306 2018-05-05 18:03:51 28465 [Note] IPv6 is available. 2018-05-05 18:03:51 28465 [Note] - '::' resolves to '::'; 2018-05-05 18:03:51 28465 [Note] Server socket created on IP: '::'. 2018-05-05 18:03:51 28465 [ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.user' doesn't exist 180505 18:03:51 mysqld_safe mysqld from pid file /usr/local/mysql/data/mysql/training.pid ended 180505 18:19:25 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/data/mysql 2018-05-05 18:19:26 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details). 2018-05-05 18:19:26 0 [Note] /usr/local/mysql/bin/mysqld (mysqld 5.6.33) starting as process 28629 ... 2018-05-05 18:19:26 28629 [Note] Plugin 'FEDERATED' is disabled. /usr/local/mysql/bin/mysqld: Table 'mysql.plugin' doesn't exist 2018-05-05 18:19:26 28629 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
最后竟然是通過重裝,然后重啟服務就好了~~
[root@training mysql]# wget http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm [root@training mysql]# rpm -ivh mysql-community-release-el7-5.noarch.rpm [root@training mysql]# yum install mysql-community-server [root@training mysql]# service mysql restart