Mysql 創建數據表外鍵報錯:Fail to open the referenced table

在mysql中,建立外鍵關聯,關聯表必須是使用innodb,將engine修改爲innodb即可。

存儲引擎是什麼?

MySQL中的數據用各種不同的技術存儲在文件(或者內存)中。這些技術中的每一種技術都使用不同的存儲機制、索引技巧、鎖定水平並且最終提供廣泛的不同的功能和能力。通過選擇不同的技術,你能夠獲得額外的速度或者功能,從而改善你的應用的整體功能。

關於數據庫其它幾個引擎的區別如下:

mysql> show engines;

+------------+---------+------------------------------------------------------------+

| Engine     | Support | Comment                                                    |

+------------+---------+------------------------------------------------------------+

| MyISAM     | DEFAULT | Default engine as of MySQL 3.23 with great performance     |

| HEAP       | YES     | Alias for MEMORY                                           |

| MEMORY     | YES     | Hash based, stored in memory, useful for temporary tables  |

| MERGE      | YES     | Collection of identical MyISAM tables                      |

| MRG_MYISAM | YES     | Alias for MERGE                                            |

| ISAM       | NO      | Obsolete storage engine, now replaced by MyISAM            |

| MRG_ISAM   | NO      | Obsolete storage engine, now replaced by MERGE             |

| InnoDB     | YES     | Supports transactions, row-level locking, and foreign keys |

| INNOBASE   | YES     | Alias for INNODB                                           |

| BDB        | NO      | Supports transactions and page-level locking               |

| BERKELEYDB | NO      | Alias for BDB                                              |

| NDBCLUSTER | NO      | Clustered, fault-tolerant, memory-based tables             |

| NDB        | NO      | Alias for NDBCLUSTER                                       |

| EXAMPLE    | NO      | Example storage engine                                     |

| ARCHIVE    | NO      | Archive storage engine                                     |

| CSV        | NO      | CSV storage engine                                         |

+------------+---------+------------------------------------------------------------+

16 rows in set (0.01 sec)

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章