问题现象
![图片[1] - mysql服务启动失败 - 正则时光](https://www.regular.cc/wp-content/uploads/2024/06/b5ba866a2af7569de219a26ff540dc8.png)
分析方法
使用systemctl restart mysq
l尝试重启mysql,提示如下信息。
![图片[2] - mysql服务启动失败 - 正则时光](https://www.regular.cc/wp-content/uploads/2024/06/image-67.png)
根据提示命令去查看情况,这里我们执行journalctl -xe
![图片[3] - mysql服务启动失败 - 正则时光](https://www.regular.cc/wp-content/uploads/2024/06/e8e0c4e11c6d66435212af8f92e371a-1024x225.png)
注意到有这么一句话:If this is not the case, make sure the /var/lib/mysql is empty before running mysql-prepare-db-dir.(如果不是这样,请确保/var/lib/mysql为空,然后再运行mysqlprepare-db-dir。)
是说前面的mariadb已经被初始化了,如果没有初始化成功,请确保/var/lib/mysql目录为空。
解决办法
查看/var/lib/mysql是否为空。我们这里查看到确实不为空。删除这个目录下所有内容。
再次执行systemctl restart mysql
,成功!
![图片[4] - mysql服务启动失败 - 正则时光](https://www.regular.cc/wp-content/uploads/2024/06/7a928d4195ecdc8765050f79e6f5c9f-1024x287.png)
© 版权声明
文章版权归作者所有,未经允许请勿转载。
THE END