Mysql reports an error cannot add foreign key constraint when using Navicat to create a foreign key, as shown below:
##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!