帆软连接mysql数据库失败 (mysql启动失败日志)

启动运行于linux环境上的mysql数据库失败,导致业务无法正常进行。对此问题进行排查,手动去启动mysql数据库。启动过程如下:

1.进入mysql数据库所在的linux用户

su - ebaserdb

2.使用tailf查看mysql数据库启动过程中的日志

tailf /home/ebaserdb/log/mysqld1.log

3.使用启动命令来执行mysql数据库的启动

mysql.server start

然后观察数据库日志在启动过程中的数据:

2018-12-04T06:27:41.500719Z 0 [Warning] Insecure configuration for --secure-file-priv: Current value does not restrict location of generated files. Consider setting it to a valid, non-empty path.
2018-12-04T06:27:41.500828Z 0 [Note] /home/ebaserdb/bin/xpecd (mysqld 5.7.21) starting as process 34409 ...
2018-12-04T06:27:41.561369Z 0 [Note] InnoDB: PUNCH HOLE support not available
2018-12-04T06:27:41.561439Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2018-12-04T06:27:41.561451Z 0 [Note] InnoDB: Uses event mutexes
2018-12-04T06:27:41.561461Z 0 [Note] InnoDB: GCC builtin __sync_synchronize() is used for memory barrier
2018-12-04T06:27:41.561469Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.3
2018-12-04T06:27:41.562166Z 0 [Note] InnoDB: Number of pools: 1
2018-12-04T06:27:41.562310Z 0 [Note] InnoDB: Using CPU crc32 instructions
2018-12-04T06:27:41.570436Z 0 [Note] InnoDB: Initializing buffer pool, total size = 640M, instances = 1, chunk size = 128M
2018-12-04T06:27:41.620035Z 0 [Note] InnoDB: Completed initialization of buffer pool
2018-12-04T06:27:41.627187Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
2018-12-04T06:27:41.651735Z 0 [Note] InnoDB: Highest supported file format is Barracuda.
2018-12-04T06:27:41.655370Z 0 [ERROR] InnoDB: Ignoring the redo log due to missing MLOG_CHECKPOINT between the checkpoint 6780558137 and the end 6780557824.
2018-12-04T06:27:41.655408Z 0 [ERROR] InnoDB: Plugin initialization aborted with error Generic error
2018-12-04T06:27:41.955745Z 0 [ERROR] Plugin 'InnoDB' init function returned error.
2018-12-04T06:27:41.955783Z 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2018-12-04T06:27:41.955793Z 0 [ERROR] Failed to initialize builtin plugins.
2018-12-04T06:27:41.955798Z 0 [ERROR] Aborting
2018-12-04T06:27:41.955813Z 0 [Note] Binlog end
2018-12-04T06:27:41.955873Z 0 [Note] Shutting down plugin 'MyISAM'
2018-12-04T06:27:41.955895Z 0 [Note] Shutting down plugin 'CSV'
2018-12-04T06:27:41.956982Z 0 [Note] /home/ebaserdb/bin/xpecd: Shutdown complete

可以看到ERROR的报错

mysql数据库开机自启动,mysql连接数据库引擎失败

ERROR报错信息

这种报错多是因为机器异常断点导致InnoDB的事务日志文件ib_logfile0、ib_logfile1出现问题,在该日志比较大(比数据文件大)的时候可以用来恢复数据(成功率没保证)。

因此本问题的处理方式是将这两个日志文件重命名或者移到其他目录中:

mv /home/ebaserdb/data/redo/ib_logfile0 /home

mv /home/ebaserdb/data/redo/ib_logfile1 /home

然后重新启动数据库,就不会出现报错。

注意:

如果可能需要数据恢复,那么只需要保留原始的InnoDB日志文件以便后面需要的恢复操作。 如果MySQL服务器在上述过程之后成功启动,并且所有数据都完好无损,则可以丢弃原始的InnoDB日志文件,mysql成功启动之后会重新创建适当大小的新InnoDB日志文件。