Fatal error: Can’t open and lock privilege tables: Table ‘mysql.user’ doesn’t exist
问题
mysql服务无法启动
Job for mysqld.service failed because the control process exited with error code.
See "systemctl status mysqld.service" and "journalctl -xe" for details.
查看日志 sudo vim /var/log/mysqld.log
2022-02-17T08:10:56.345209Z 0 [ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.user' doesn't exist
2022-02-17T08:10:56.345216Z 0 [ERROR] Fatal error: Failed to initialize ACL/grant/time zones structures or failed to remove temporary table files.
解决方法
- 删除文件夹/var/lib/mysql
sudo rm -rf /var/lib/mysql - 重新初始化
sudo mysqld --initialize - 重启MySQL
service mysqld restart
结果
成功启动
|