MySQL forces you to index foreign key.
MySQL requires indexes on foreign keys and referenced keys so that foreign key checks can be fast and not require a table scan.
You can read more about foreign keys on MySQL documentation pages: http://dev.mysql.com/doc/refman/5.7/en/create-table-foreign-keys.html
Just had to figure this out for myself:
Open the table you want to add foreign keys too.
Click the Structure Tab
Click the RELATION VIEW button just above the list of columns
Enter data for in the Foreign key constraints box
DO NOT index the column you want to make into a Foreign Key first. This caused my creation attempts to fail
父表中的 org_id 应该被索引,所以只需在父表中创建索引,然后创建外键。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.