MYSql cannot establish foreign key constraints

Source: Internet
Author: User
MYSql cannot establish foreign key constraints. environment: mysql + MySQLQueryBrowser table structure: & nbsp; table t: t1int primary key auto-increment & nbsp; t2int default value: 1 & nbsp; table tt: tt1int primary key auto-increment & nbsp; tt2int & nbsp; now I want to create a MYSql in the tt table. the foreign key constraint cannot be created.
Environment: mysql + MySQL Query Browser
Table structure:
Table t: t1 int primary key automatically increases
T2 int default value = 1
Table tt: tt1 int primary key automatically increases
Tt2 int

Now we want to create a foreign key constraint in the tt table, t. t1 = tt. tt2,
However, the error 1005 or 1208 is always prompted when MySQL Query Browser is created.
On. UPdate on delete I selected cascade UPdate and delete.
The fields are also matched, but why not.
Ask for advice.

------ Solution --------------------
Does your table type use innodb? If myisam does not support foreign keys.
------ Solution --------------------
Only InnoDB supports foreign key constraints.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.