1、运行systemctl start mysqld报错
Job for mysqld.service failed because the control process exited with error code. See "systemctl status mysqld.service" and "journalctl -xe" for details.
2、查看mysql日志文件:
gedit /var/log/mysqld.log
发现报错:
2023-04-20T08:16:38.242787Z 0 [ERROR] [MY-010457] [Server] --initialize specified but the data directory has files in it. Aborting.
2023-04-20T08:16:38.242809Z 0 [ERROR] [MY-013236] [Server] The designated data directory /var/lib/mysql/ is unusable. You can remove all files that the server added to it.
2023-04-20T08:16:38.242847Z 0 [ERROR] [MY-010119] [Server] Aborting
3、运行这两行代码后解决
cd /var/lib
mv mysql mysql_bak
在尝试运行systemctlstartmysqld时遇到错误,MySQL服务因控制进程退出错误而失败。日志显示数据目录已包含文件,初始化无法进行。为解决此问题,删除了/var/lib/mysql目录中的所有服务器添加的文件,并将目录重命名为mysql_bak。
6136

被折叠的 条评论
为什么被折叠?



