解决MariaDB或MySQL错误日志爆满问题

想着下载备份发现磁盘空间不够,使用 du -h --max-depth=1 / | sort -hr 逐一排查发现 /var/log/mysql 目录下的error.log日志,竟占用2GB的磁盘空间!
在WinSCP可见log文件的错误信息还在以每秒1KB的速度写入着!(激昂的语气)(笑)

主要的提示如下:

Incorrect definition of table mysql.column_stats: expected column 'hist_type' at position 9 to have type enum

上网搜寻发现与PHP有关的应用程序(Nextcloud、Wallabag,当然还有最经典的WordPress)几乎都遇到了这样的问题。

很难说原因出自哪里,但至少有一个解决方案是更新数据库表。

以MariaDB为例:

mariadb-upgrade --force

至少不会继续写入日志了,文件大小保持着稳定的体积。

发表回复

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

To respond on your own website, enter the URL of your response which should contain a link to this post's permalink URL. Your response will then appear (possibly after moderation) on this page. Want to update or remove your response? Update or delete your post and re-enter your post's URL again. (Find out more about Webmentions.)