背景: ubuntu 下运行的 django 项目, 前一天还跑的好好地, 今天突然报错, 检查后发现 mysql 启动失败
Starting mysql (via systemctl): mysql.serviceJob for mysql.service failed because the control process exited with error code. See "systemctl status mysql.service" and "journalctl -xe" for details.
得到如上提示, 按照他说的 试了一下 systemctl status mysql.service 命令, 发现得不到有效信息
你应该用命令:
tail -30 /var/log/mysql/error.log
查看打印出来的 [ERROR] 部分, 我的是这样的:
显示缓存区内存不足, 解决方案网上就很多了
http://www.prowebdev.us/2012/05/amazon-ec2-linux-micro-swap-space.html
所以, 看到报错不要着急, 寻找正确的 debug 方式很重要, 关于 mysql 的正确 debug 方式就是去看 error.log 日志. 切勿一顿骚操作瞎改
来源: http://www.jianshu.com/p/fd957a23e8f4