Home  >  Article  >  Database  >  What should I do if navicat reports an error when setting foreign keys?

What should I do if navicat reports an error when setting foreign keys?

爱喝马黛茶的安东尼
爱喝马黛茶的安东尼Original
2019-08-15 13:48:133626browse

What should I do if navicat reports an error when setting foreign keys?

Mysql reports an error cannot add foreign key constraint when using Navicat to create a foreign key, as shown below:

What should I do if navicat reports an error when setting foreign keys?

##Related recommendations: "

Navicat for mysql graphic tutorial

Solution:

(1) Check whether the type or length of the field to be associated is inconsistent.

(2) Check whether the codes of the two tables to be associated are different.

(3) Check whether a table already has records.

(4) Set both "when deleted" and "when updated" to be the same, such as setting both to CASCADE.

The above is the detailed content of What should I do if navicat reports an error when setting foreign keys?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn