centos7 mysql57启动失败,求助各位大牛,谢谢
Recentos7 mysql57启动失败,求助各位大牛,谢谢
[root@iZwz93p6s96kf3o2vkh73mZ ~]# rpm -qa |grep mysql
mysql-community-common-5.7.22-1.el7.x86_64
mysql-community-client-5.7.22-1.el7.x86_64
mysql-community-server-5.7.22-1.el7.x86_64
mysql57-community-release-el7-7.noarch
mysql-community-libs-5.7.22-1.el7.x86_64
mysql-community-devel-5.7.22-1.el7.x86_64
[root@iZwz93p6s96kf3o2vkh73mZ ~]# systemctl status mysqld.service
● mysqld.service - MySQL Server
Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)
Active: activating (start) since Tue 2018-04-24 02:38:40 CST; 202ms ago
Docs: man:mysqld(8)
http://dev.mysql.com/doc/refman/en/using-systemd.html
Process: 21555 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS)
Control: 21578 (mysqld)
CGroup: /system.slice/mysqld.service
├─21578 /usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid
└─21582 /usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid
Apr 24 02:38:40 iZwz93p6s96kf3o2vkh73mZ systemd[1]: mysqld.service holdoff time over, scheduling restart.
Apr 24 02:38:40 iZwz93p6s96kf3o2vkh73mZ systemd[1]: Starting MySQL Server...
Apr 24 02:38:40 iZwz93p6s96kf3o2vkh73mZ mysqld_pre_systemd[21555]: 2018-04-23T18:38:40.694283Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
Apr 24 02:38:40 iZwz93p6s96kf3o2vkh73mZ mysqld_pre_systemd[21555]: 2018-04-23T18:38:40.696498Z 0 [ERROR] --initialize specified but the data directory has files in it. Aborting.
Apr 24 02:38:40 iZwz93p6s96kf3o2vkh73mZ mysqld_pre_systemd[21555]: 2018-04-23T18:38:40.696515Z 0 [ERROR] Aborting
[root@iZwz93p6s96kf3o2vkh73mZ ~]# journalctl -xe
Apr 24 02:39:00 iZwz93p6s96kf3o2vkh73mZ mysqld_pre_systemd[21988]: 2018-04-23T18:39:00.944181Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
Apr 24 02:39:00 iZwz93p6s96kf3o2vkh73mZ mysqld_pre_systemd[21988]: 2018-04-23T18:39:00.946474Z 0 [ERROR] --initialize specified but the data directory has files in it. Aborting.
Apr 24 02:39:00 iZwz93p6s96kf3o2vkh73mZ mysqld_pre_systemd[21988]: 2018-04-23T18:39:00.946491Z 0 [ERROR] Aborting
Apr 24 02:39:01 iZwz93p6s96kf3o2vkh73mZ mysqld[22011]: Initialization of mysqld failed: 0
Apr 24 02:39:01 iZwz93p6s96kf3o2vkh73mZ systemd[1]: mysqld.service: control process exited, code=exited status=1
Apr 24 02:39:03 iZwz93p6s96kf3o2vkh73mZ systemd[1]: Failed to start MySQL Server.
-- Subject: Unit mysqld.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit mysqld.service has failed.
--
-- The result is failed.
Apr 24 02:39:03 iZwz93p6s96kf3o2vkh73mZ systemd[1]: Unit mysqld.service entered failed state.
Apr 24 02:39:03 iZwz93p6s96kf3o2vkh73mZ systemd[1]: mysqld.service failed.
Apr 24 02:39:03 iZwz93p6s96kf3o2vkh73mZ systemd[1]: mysqld.service holdoff time over, scheduling restart.
Apr 24 02:39:03 iZwz93p6s96kf3o2vkh73mZ systemd[1]: Starting MySQL Server...
-- Subject: Unit mysqld.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
[root@iZwz93p6s96kf3o2vkh73mZ ~]# grep 'ERROR' /var/log/mysqld.log
2018-04-23T18:14:00.881418Z 0 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
2018-04-23T18:14:00.886712Z 0 [ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.user' doesn't exist
2018-04-23T18:14:00.886751Z 0 [ERROR] Aborting
[root@iZwz93p6s96kf3o2vkh73mZ ~]# cat /etc/my.cnf
# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.7/en/server-configuration-defaults.html
[mysqld]
#
# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
# innodb_buffer_pool_size = 128M
#
# Remove leading # to turn on a very important data integrity option: logging
# changes to the binary log between backups.
# log_bin
#
# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
[root@iZwz93p6s96kf3o2vkh73mZ ~]# mysql_install_db --user=mysql --datadir=/var/lib/mysql/
2018-04-24 02:42:39 [WARNING] mysql_install_db is deprecated. Please consider switching to mysqld --initialize
2018-04-24 02:42:39 [ERROR] The data directory '/var/lib/mysql/' already exist and is not empty.
[root@iZwz93p6s96kf3o2vkh73mZ ~]# ll /var/lib/mysql/
total 122924
-rw-r----- 1 mysql mysql 56 Apr 24 01:42 auto.cnf
-rw------- 1 mysql mysql 1679 Apr 24 00:32 ca-key.pem
-rw-r--r-- 1 mysql mysql 1107 Apr 24 00:32 ca.pem
-rw-r--r-- 1 mysql mysql 1107 Apr 24 00:32 client-cert.pem
-rw------- 1 mysql mysql 1675 Apr 24 00:32 client-key.pem
-rw-r----- 1 mysql mysql 281 Apr 24 02:43 ib_buffer_pool
-rw-r----- 1 mysql mysql 12582912 Apr 24 02:43 ibdata1
-rw-r----- 1 mysql mysql 50331648 Apr 24 02:43 ib_logfile0
-rw-r----- 1 mysql mysql 50331648 Apr 24 01:42 ib_logfile1
-rw-r----- 1 mysql mysql 12582912 Apr 24 02:43 ibtmp1
srwxrwxrwx 1 mysql mysql 0 Apr 24 02:43 mysql.sock
-rw------- 1 mysql mysql 6 Apr 24 02:43 mysql.sock.lock
-rw------- 1 mysql mysql 1675 Apr 24 00:32 private_key.pem
-rw-r--r-- 1 mysql mysql 451 Apr 24 00:32 public_key.pem
-rw-r--r-- 1 mysql mysql 1107 Apr 24 00:32 server-cert.pem
-rw------- 1 mysql mysql 1675 Apr 24 00:32 server-key.pem
[root@iZwz93p6s96kf3o2vkh73mZ ~]# service mysqld start
Redirecting to /bin/systemctl start mysqld.service
Job for mysqld.service failed because the control process exited with error code. See 'systemctl status mysqld.service' and 'journalctl -xe' for details.
-------------------------
回 2楼dongshan8的帖子
Redirecting to /bin/systemctl start mysqld.service
Job for mysqld.service failed because the control process exited with error code. See 'systemctl status mysqld.service' and 'journalctl -xe' for details.
[root@iZwz93p6s96kf3o2vkh73mZ ~]# mkdir -p /data/mysql[root@iZwz93p6s96kf3o2vkh73mZ ~]# ll /data/mysql
total 0
[root@iZwz93p6s96kf3o2vkh73mZ ~]# mysql_install_db --user=mysql --datadir=/data/mysql/
2018-04-24 11:36:48 [WARNING] mysql_install_db is deprecated. Please consider switching to mysqld --initialize
2018-04-24 11:36:48 [ERROR] The data directory '/data/mysql/' already exist and is not empty.
依旧如此,版主,怎么破?
赞0
踩0