[精讚] [會員登入]
1085

[Docker] Mariadb-Galera出現Incorrect definition of table mysql.column_stats:'hist_type'及 'histogram'

使用docker的Mariadb-galera出現'hist_type'及 'histogram'型別錯誤的解決方法。

分享此文連結 //n.sfs.tw/16443

分享連結 [Docker] Mariadb-Galera出現Incorrect definition of table mysql.column_stats:'hist_type'及 'histogram'@新精讚
(文章歡迎轉載,務必尊重版權註明連結來源)
最後編修
2024-08-24 10:48:44 By 張○○
 

自動目錄

自從上週發生資料庫系統整個被撐爆,所有的資料庫死機起動不了的意外,可以參考 [Rocky9+Docker] Mariadb Cluster + HAPROXY + Docker compose@新精讚 裡的錯誤排除。

我幾天就開始很注意他的容量問題,結果發現資料庫log每天以600mb的速度在長大,我並不知道他到底為什麼長得這麼快,所以第一招就是不要寫入binlog的記錄:

關閉記錄檔

修改設定檔

[mysqld]
skip-log-bin  <==加入這行
log_bin ='/var/log/mysql/mariadb-bin'
binlog_format='row'
expire_logs_days=1
max_binlog_size = 10M <==加入這行

第一行加入 skip-log-bin [1] ,其它參數保留不要註解,以免出現其它的錯誤。

錯誤訊息

以上我並沒有測試容量是否就不會長大,接下來就前景啟動試試看,結果發現一直跳出大量的這個log,我感覺我發現原因了:

[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').
[ERROR] Incorrect definition of table mysql.column_stats: expected column 'histogram' at position 10 to have type longblob, found type varbinary(255).

上網查了很多解決,全部沒效,例如加入環境參數[2]:

    environment:
    ....
      - MARIADB_AUTO_UPGRADE=1
      - MARIADB_INITDB_SKIP_TZINFO=1

沒效。

例如執行更新指令 docker-compose exec mariadb mysql_upgrade -uroot -ppassword 得到錯誤[3]

OCI runtime exec failed: exec failed: unable to start container process: exec: "mysql_upgrade": executable file not found in $PATH: unknown

沒效

解決

後來仔細看了錯誤,自己試著修改欄位的格式就解決了

進到資料庫下指令:

ALTER TABLE `column_stats` CHANGE `hist_type` `hist_type` ENUM('SINGLE_PREC_HB','DOUBLE_PREC_HB','JSON_HB') CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NULL DEFAULT NULL;

ALTER TABLE `column_stats` CHANGE `histogram` `histogram` LONGBLOB NULL DEFAULT NULL;

結果後面才發現有人的解法和我一樣[4],呵呵。

 

參考資料

[1] https://dba.stackexchange.com/questions/72770/disable-mysql-binary-logging-with-log-bin-variable

[2] https://github.com/docker-library/docs/issues/2164

[3] https://techoverflow.net/2022/06/07/how-to-fix-docker-mariadb-correct-definition-of-table-mysql-column_stats-expected-column-hist_type-at-position-9/

[4] https://github.com/wallabag/wallabag/issues/6572

END

你可能感興趣的文章

[Mysql/Mariadb] 利用phpMyAdmin 建立關聯式資料表 利用phpMyAdmin 建立關聯式資料表

[Mysql] 使用索引來加速搜尋 只要是常常用到搜索條件的欄位,就應該把它設成索引鍵,有無設定的速度差可能會好幾倍

[Mysql] 建立叢集式資料庫3/4 -- DB1設置及DB PROXY 使用galera建立Mysql的叢集式資料庫 ,繼續修正第1DB及運作PROXY

Mysql INSERT ... ON DUPLICATE KEY UPDATE 寫法,MYSQL如果存在的修改,不存在就新增的寫法 Mysql有則修改,無則新增的sql寫法

[Mysql/Mariadb] 忘記root密碼 常常會忘記root 密碼,簡單的幾步驟回復

[Mysql] 使用union合併兩個表 mysql合併兩個表的方法,使用union

隨機好文

NETCRAFT發現你的網站及作業系統 NETCRAFT可以發現你的網站及作業系統

[AS3] 我做的唯一一個Flash As3遊戲UFO INVADSION [AS3] 我做的唯一一個Flash As3遊戲,是第一個也是最後一個,後來就沒再寫as3,不過as3還滿好玩的。

APACHE的記錄檔格式 LogFormat 語法 在APACHE中有定義一些記錄的語法模版 在 /etc/httpd/conf/httpd.conf 中: LogForm

[MAC] 安裝APACHE+PHP OS Darwin OpenIDMac1deAir 15.6.0 Darwin Kernel Version 15.6.

此一時彼一時 我是不是易怒的人,其實我也不知道,總之我常會失控,不知道自己在幹嘛。這近生活過得浮浮的,不是很踏實,總會想太多,我甚至會