树莓派进水断电重启后Mysql起不来

错误日志类似于:

90119 12:55:54 InnoDB: Using Linux native AIO
190119 12:55:54 InnoDB: Initializing buffer pool, size = 128.0M
190119 12:55:54 InnoDB: Completed initialization of buffer pool
190119 12:55:54 InnoDB: highest supported file format is Barracuda.
190119 12:55:54  InnoDB: Starting crash recovery from checkpoint LSN=25825591529
InnoDB: Restoring possible half-written data pages from the doublewrite buffer...
190119 12:55:54  InnoDB: Starting final batch to recover 15 pages from redo log
190119 12:55:54 [ERROR] mysqld got signal 11 ;

解决办法:

修改/etc/my.cnf配置文件:
添加参数:
innodb_force_recovery = 6 (此项由1—6个级别一次往上修改参数在失败的情况下)
innodb_purge_threads = 0

整体配置如下:

[mysqld]
innodb_force_recovery=6
innodb_purge_threads = 0
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
# Settings user and group are ignored when systemd is used.
# If you need to run mysqld under a different user or group,
# customize your systemd unit file for mariadb according to the
# instructions in http://fedoraproject.org/wiki/Systemd

[mysqld_safe]
log-error=/var/log/mariadb/mariadb.log
pid-file=/var/run/mariadb/mariadb.pid

#
# include all files from the config directory
#
!includedir /etc/my.cnf.d

启动完后记得注释掉第一条第二条,否则有副作用,盲猜无法写入。

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注