Docker MariaDB: Beheben von „correct definition of table mysql.column_stats: expected column 'hist_type' at position 9...“

English Deutsch

Problem:

Im Protokoll Ihres MySQL-Docker-Servers sehen Sie Einträge wie

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).

Lösung

Dies geschieht nach einem Versionsupgrade der MySQL-Version.

Um das Problem zu beheben, führen Sie das Upgrade aus, indem Sie mysql_upgrade im Container ausführen

mariadb_mysql_upgrade.sh
docker-compose exec mariadb mysql_upgrade -uroot -pchopahl0aib4eiphuk5bao3shiVoow

wobei chopahl0aib4eiphuk5bao3shiVoow Ihr MySQL-Root-Passwort ist.

Wenn Sie Ihr Passwort in .env gespeichert haben, wie wir empfehlen, können Sie diesen Befehl verwenden:

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