Mysql突然就连接不上了,重新启动也一直失败

查看了下日志

tail -100 /var/log/mariadb/mariadb.log

报错如下:

180903 16:11:37 InnoDB: The InnoDB memory heap is disabled
180903 16:11:37 InnoDB: Mutexes and rw_locks use GCC atomic builtins
180903 16:11:37 InnoDB: Compressed tables use zlib 1.2.7
180903 16:11:37 InnoDB: Using Linux native AIO
180903 16:11:37 InnoDB: Initializing buffer pool, size = 128.0M
180903 16:11:37 InnoDB: Completed initialization of buffer pool
180903 16:11:37 InnoDB: highest supported file format is Barracuda.
InnoDB: Error: tried to read 65536 bytes at offset 0 1872384.
InnoDB: Was only able to read 15872.
180903 16:11:41  InnoDB: Operating system error number 5 in a file operation.
InnoDB: Error number 5 means 'Input/output error'.
InnoDB: Some operating system error numbers are described at
InnoDB: http://dev.mysql.com/doc/refman/5.5/en/operating-system-error-codes.html
InnoDB: File operation call: 'read'.
InnoDB: Cannot continue operation.

后面搜索了下,应该是日志文件过大,导致无法写入,我直接把日子文件清空就解决了

echo "" > /var/log/mariadb/mariadb.log

重启。

除此之外应该也可以选择修改日志文件大小来解决。

参考文档InnoDB: Error: log file ./ib_logfile0 is of different size