[精讚] [會員登入]
1022

[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] 修改資料庫預設校對或編碼 修改資料庫預設校對或編碼的方法

[Mysql/MariaDB] 修改資料庫、表格或欄位名稱 Mysql/MariaDB修改資料庫、表格或欄位名稱

[mysqldump] Mysqldump時出現記憶體錯誤Out of memory 當進行 mysqldump 時出現 Out of memory (Needed xxxxx bytes) 的錯誤,該如何處理?

[Mysql/MariaDB] 表格的引擎 (engine):查看及修改 MySQL表格引擎預設為 MyISAM,但在4.0以上的mysql 其實支援不只一種引擎,各有優缺點,這篇介紹引擎的操作。

[Mysql] 修改欄位的自動索引值autoindex (auto_increment ) Mysql 新增、刪除、修改、查看欄位的自動索引值autoindex (auto_increment)

[MySQL] console mode 的亂碼處理 使用MySQL的console mode如果出現亂碼 在,要怎麼處理?

隨機好文

沒有非誰做不可的事,也沒有不可被取代的人 沒有非誰做不可的事,也沒有不可被取代的人

[Freebsd] 使用 ADSL 撥接上網 Freebsd上要使用 ADSL 撥接上網,該如何設定?

[Win7] 燒錄 iso 檔 在Windows7 中內建燒錄程式,可以直接把檔案拉到光碟機裡,再執行燒錄。

世紀帝國征服者新版本--被遺忘的帝國 世紀帝國征服者新版本--被遺忘的帝國 世紀二代的征服者是精典遊戲中的精典,aofe更好玩...

[PHP] 檢查檔案是否是圖檔 使用getimagesize函數檢查檔案是否是圖檔