昨天,在測試新的數據庫時,遷移表遇到了這個問題。現在記錄一下解決方案。
1.在配置文件中添加關閉嚴格模式的配置:sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
2.在配置文件中添加使用獨立表空間的配置:innodb_file_per_table=1
3.在數據庫中執行:SHOW GLOBAL VARIABLES LIKE '%innodb_file%';
+--------------------------+-----------+ | Variable_name | Value | +--------------------------+-----------+ | innodb_file_format | Barracuda | | innodb_file_format_check | ON | | innodb_file_format_max | Barracuda | +--------------------------+-----------+
確保innodb_file_format 使用的是Barracuda,如果不是執行以下語句:SET GLOBAL innodb_file_format = barracuda;
此時,即可解決mysql報錯1118的問題。
以下是問題圖片: