centos7中MySQL无法启动:
问题描述
在使用systemctl status mysqld指令时出现 Job for mysqld.service failed because the control process exited with error code:
[root@localhost ~]# 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.
解决方案:
1.: cat /etc/my.cnf -->找到 datadir对应的目录
2.:为防止权限不够,修改文件权限:chmod -R 777 /var/lib/mysql
3.:删除该目录下的文件:rm -rf /var/lib/mysql/*
4.:重新启动MySQL服务:service mysqld restart
5.:查看MySQL服务的状态:systemctl status mysqld
最后的结果: