记一次mysql 重启失败

今天重启mysql发现报错如下:

$ sudo service mysqld restart

Redirecting to /bin/systemctl restart mysqld.service
Job for mysqld.service failed because the control process exited with error code. See "systemctl status mysqld.service" and "journalctl -xe" for details

解决思路:查看mysql error log

vim /etc/my.cnf

日志文件位置如下:

log-error=/var/log/mysqld.log
less /var/log/mysqld.log

发现如下报错信息
mysqld: File ‘/var/log/mysql/mysql-bin.index‘ not found (OS errno 13 - Permission denied)
2020-05-28T07:43:55.744384Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.20) starting as process 17788
2020-05-28T07:43:55.747675Z 0 [ERROR] [MY-010119] [Server] Aborting

发现是没有权限执行导致的重启失败。添加权限,问题解决

sudo chmod -R 777 /var/log/mysql/*

相关推荐