如何修复 docker MariaDB correct definition of table mysql.column_stats: expected column hist_type at position 9...
问题:
在你的 MySQL docker 服务器的日志中,你看到类似这样的日志
mariadb_column_stats_error.txt
mariadb_1 | 2022-06-07 20:24:00 283 [ERROR] Incorrect definition of table mysql.column_stats: expected column 'hist_type' at position 9 to have type enum('SINGLE_PREC_HB','DOUBLE_PREC_HB','JSON_HB'), found type enum('SINGLE_PREC_HB','DOUBLE_PREC_HB').
mariadb_1 | 2022-06-07 20:24:00 283 [ERROR] Incorrect definition of table mysql.column_stats: expected column 'histogram' at position 10 to have type longblob, found type varbinary(255).解决方案
这发生在进行 MySQL 版本升级后。
为了修复它,通过在容器中运行 mysql_upgrade 来运行升级
mariadb_mysql_upgrade.sh
docker-compose exec mariadb mysql_upgrade -uroot -pchopahl0aib4eiphuk5bao3shiVoow其中 chopahl0aib4eiphuk5bao3shiVoow 是你的 MySQL root 密码。
如果你按照我们推荐的方式将密码放在 .env 中,你可以使用此命令:
mariadb_mysql_upgrade_env.sh
source .env && docker-compose exec mariadb mysql_upgrade -uroot -p${MARIADB_ROOT_PASSWORD}Check out similar posts by category:
Docker
If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow