Mysql

MySQL 儲存引擎在低版本恢復備份時從 InnoDB 更改為 MyISAM

  • November 8, 2017

我有兩個生產實例,舊生產實例有 MySQL 版本“5.1.73-community-log”,新生產實例有 MySQL 版本“5.1.72-community”

當我從舊生產實例備份到新生產實例時,一些 InnoDB 表更改為 MyISAM 表。

我在兩個實例中的設置幾乎相同,不同之處在於我在新生產實例上更改了“innodb_log_buffer_size”和“innodb_log_file_size”以加快恢復過程。

改變效果:

  1. 因此,在表引擎以前是 InnoDB 而現在是 MyISAM 的情況下,所有引用完整性都失去了。
  2. 在“SELECT、INSERT、UPDATE”查詢中經常出現“LOCKING”。

我無法找到正確的原因,因為當我檢查 SHOW ENGINES 時,它顯示以下結果,這意味著 InnoDB 已啟用:

mysql> SHOW ENGINES;
+------------+---------+----------------------------------------------------------------+--------------+------+------------+
| Engine     | Support | Comment                                                        | Transactions | XA   | Savepoints |
+------------+---------+----------------------------------------------------------------+--------------+------+------------+
| InnoDB     | YES     | Supports transactions, row-level locking, and foreign keys     | YES          | YES  | YES        |
| MRG_MYISAM | YES     | Collection of identical MyISAM tables                          | NO           | NO   | NO         |
| BLACKHOLE  | YES     | /dev/null storage engine (anything you write to it disappears) | NO           | NO   | NO         |
| CSV        | YES     | CSV storage engine                                             | NO           | NO   | NO         |
| MEMORY     | YES     | Hash based, stored in memory, useful for temporary tables      | NO           | NO   | NO         |
| FEDERATED  | NO      | Federated MySQL storage engine                                 | NULL         | NULL | NULL       |
| ARCHIVE    | YES     | Archive storage engine                                         | NO           | NO   | NO         |
| MyISAM     | DEFAULT | Default engine as of MySQL 3.23 with great performance         | NO           | NO   | NO         |
+------------+---------+----------------------------------------------------------------+--------------+------+------------+
8 rows in set (0.00 sec)

如果備份是從在 CREATE TABLE 語句中不包含 ENGINE 的 .sql 轉儲中恢復的,MySQL 將回退到“ default_storage_engine ”(5.7 手動版本),在 5.5.5 之前是“MyISAM”

實際上我發現了這個問題,當我從 .sql 文件中恢復數據庫時,InnoDB 儲存引擎被禁用,因為所有 InnoDB 類型的表都被導入為 MyISAM 表。

引用自:https://dba.stackexchange.com/questions/187124