mysql启动报错--initialize specified but the data directory has files in it

版权声明: https://blog.csdn.net/zhydream77/article/details/82112604

目录

 

错误提示:

处理方案:


错误提示:

[root@slave1 ~]# systemctl restart mysqld
Job for mysqld.service failed because the control process exited with error code. See "systemctl status mysqld.service" and "journalctl -xe" for details.

[root@slave1 ~]# systemctl status mysqld.service
● mysqld.service - MySQL Server
   Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)
   Active: activating (start-pre) since 一 2018-08-27 14:36:55 CST; 1s ago
     Docs: man:mysqld(8)
           http://dev.mysql.com/doc/refman/en/using-systemd.html
  Process: 25888 ExecStart=/usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid $MYSQLD_OPTS (code=exited, status=1/FAILURE)
  Control: 25919
   CGroup: /system.slice/mysqld.service
           └─25948 /usr/lib/systemd/systemd --switched-root --system --deserialize 21

8月 27 14:36:55 slave1 systemd[1]: mysqld.service holdoff time over, scheduling restart.
8月 27 14:36:55 slave1 systemd[1]: Starting MySQL Server...
8月 27 14:36:57 slave1 mysqld_pre_systemd[25919]: 2018-08-27T06:36:57.005773Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp...ore details).
8月 27 14:36:57 slave1 mysqld_pre_systemd[25919]: 2018-08-27T06:36:57.007256Z 0 [ERROR] --initialize specified but the data directory has files in it. Aborting.
8月 27 14:36:57 slave1 mysqld_pre_systemd[25919]: 2018-08-27T06:36:57.007274Z 0 [ERROR] Aborting
Hint: Some lines were ellipsized, use -l to show in full.

处理方案:

1.查看配置文件datadir的路径

[root@slave1 ~]# cat /etc/my.cnf

datadir=/var/lib/mysql

2.清空/var/lib/mysql文件夹下的内容,在重新启动即可

[root@slave1 local]# cd /var/lib/mysql
[root@slave1 mysql]# ls
auto.cnf    ca.pem           client-key.pem  ibdata1      ib_logfile1  mysql.sock       private_key.pem  server-cert.pem
ca-key.pem  client-cert.pem  ib_buffer_pool  ib_logfile0  ibtmp1       mysql.sock.lock  public_key.pem   server-key.pem
[root@slave1 mysql]# rm -rf *
[root@slave1 mysql]# ls
[root@slave1 mysql]# systemctl restart mysqld

 

猜你喜欢

转载自blog.csdn.net/zhydream77/article/details/82112604