Centos 7 使用Shell脚本定时检查MySql服务运行状态

MySQL监控脚本:

#!/bin/bash
pgrep mysqld &> /dev/null
if [ $? -gt 0 ]
then
echo "`date` ERROR! MySQL is not running" >> /home/mysqlstatus.log
systemctl start mysqld >> /home/mysqlstatus.log
else
echo "`date` SUCCESS! MySQL running" >> /home/mysqlstatus.log
fi

继续阅读“Centos 7 使用Shell脚本定时检查MySql服务运行状态”

mysql 数据库宕机问题解决

查看log,内容如下:
vim /var/log/mysqld.log

问题1:
2020-07-30T03:46:12.732170Z 2 [Warning] InnoDB: Table mysql/innodb_index_stats has length mismatch in the column name table_name. Please run mysql_upgrade
2020-07-30T03:46:13.431987Z 0 [Note] InnoDB: Buffer pool(s) load completed at 200730 11:46:13

运行:
shell: mysql_upgrade –host=’127.0.0.1′ –port=3306 –user=’root’ –password=”root”

继续阅读“mysql 数据库宕机问题解决”