记一次数据库奇怪的毛病
今天打开站点,发现跳出错误 Error establishing a database connection
。
去后台看了眼数据库,尝试重启失败。
尝试重启:systemctl start mysql
Job for mysqld.service failed because the control process exited with error code.
See "systemctl status mysqld.service" and "journalctl -xeu mysqld.service" for details.
查看状态systemctl status mysql.service
× mysqld.service - LSB: start and stop MySQL
Loaded: loaded (/etc/init.d/mysqld; generated)
Active: failed (Result: exit-code); 5min ago
Docs: man:systemd-sysv-generator(8)
Process: 4877 ExecStart=/etc/init.d/mysqld start (code=exited, status=1/FAILURE)
CPU: 3.696s
systemd[1]: Starting LSB: start and stop MySQL...
mysqld[4877]: Starting MySQL..... * The server quit without updating PID file
systemd[1]: mysqld.service: Control process exited, code=exited, status=1/FAILURE
systemd[1]: mysqld.service: Failed with result 'exit-code'.
systemd[1]: Failed to start LSB: start and stop MySQL.
再看启动Log:
mysqld: File './mysql-bin.000028' not found (OS errno 2 - No such file or directory)
[ERROR] [MY-010958] [Server] Could not open log file.
[ERROR] [MY-010041] [Server] Can't init tc log
[ERROR] [MY-010119] [Server] Aborting
看了眼目录下有个mysql-bin.000027
,于是直接复制了一份。
cp mysql-bin.000027 mysql-bin.000028
chown mysql:mysql mysql-bin.000028
重启成功。
后续:查到了类似的问题,说是把mysql-bin.*
全删了,或者把mysql-bin.index
中相关的文件名删掉。但至于是怎么出现的问题,还是不清楚。