启动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

相关文章:

  • 2022-12-23
  • 2021-07-11
  • 2022-12-23
  • 2021-06-03
  • 2022-01-18
  • 2022-12-23
  • 2022-12-23
  • 2022-02-13
猜你喜欢
  • 2021-12-25
  • 2022-01-15
  • 2021-04-10
  • 2021-11-29
  • 2021-12-05
相关资源
相似解决方案