Today, using NAVCAT to add foreign keys to a table error:
You have a error in your SQL syntax; Check the manual-corresponds to your MySQL server version for the right syntax-use-near ' Type=innodb ' on line 1
After troubleshooting, it was discovered that the types of the two tables were not the same:
Sql:show Table Status Query the state of the data table, engine that column is
To modify a table type using a statement: ALTER table ' cms_channel ' ENGINE = INNODB;
Problem solving
===============================================================
By the way, give the SQL statement that added the foreign key:
ALTER TABLE name add constraint fk_id foreign key (your foreign key field name) REFERENCES the outer table name (the primary key field name of the corresponding table);
Example:
ALTER TABLE cms_article add constraint fk_article_dept_1 foreign key (dept_id) REFERENCES sys_department (ID);
Use this statement to run without error, the client will also prompt the function to modify how many data, but re-query the database table structure when the changes are not successful, because the table type is not the same as the foreign key can not be established
MYSQ Add foreign key error: Check the manual, corresponds to your MySQL server version for the right syntax ' a T Line 1