MySQL5.7 启动报错:initialize specified but the data directory has files in it. Aborting.

https://blog.csdn.net/liyf155/article/details/61420126

刚安装好的MySQL5.7.12,执行service mysqld start时报错,内容如下: 
2017-02-19T07:52:53.807647Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use –explicit_defaults_for_timestamp server option (see documentation for more details). 
2017-02-19T07:52:53.809065Z 0 [ERROR] –initialize specified but the data directory has files in it. Aborting. 
2017-02-19T07:52:53.809095Z 0 [ERROR] Aborting

其中红色字体里面说明,mysql中的data目录已经有数据了,解决方案:

vim /etc/my.cnf,
1

MySQL5.7 启动报错:initialize specified but the data directory has files in it. Aborting._第1张图片
datadir=/var/lib/mysql, 这个是data保存目录,进入/var/lib/mysql后,查看到确实有数据: 

MySQL5.7 启动报错:initialize specified but the data directory has files in it. Aborting._第2张图片


将/var/lib/mysql备份,然后重新启动mysql: 

MySQL5.7 启动报错:initialize specified but the data directory has files in it. Aborting._第3张图片

你可能感兴趣的:(Mysql)