启动MySQL5.7时报错:initialize specified but the data directory has files in it. Aborting.
启动MySQL5.7时报错:initialize specified but the data directory has files in it. Aborting
解决方法:
vim /etc/my.cnf 查看文件,寻找datadir=... 查看到:datadir=/usr/local/mysql/data, 这个是data保存目录。 进入/usr/local/mysql/data后,查看到确实有数据: 将/usr/local/mysql/data备份, cd /usr/local/mysql mv data data.bak 接着执行: # mysqld --initialize-insecure --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data
# systemctl start mysqld