car_testt table and the associated watch is usert, which I think car_testt table set in the foreign key user_id, index is set up, but has been unable to appear problem, cannot succeed, please answer oh CodePudding user response:
Error mean cannot create code constraints, carefully check the data type of the field, such as whether the same with the table, I met this problem, it is just because of the different coding, I use of sjis and correlation of the corresponding fields in the table with the utf8, change to be the same with respect to ok,
CodePudding user response:
I checked the, not seems like CodePudding user response:
reference 1st floor u013495762 response: error mean cannot create code constraints, carefully check the data type of the field, such as whether the same with the table, I met this problem, it is just because of the different coding, I use of sjis and correlation of the corresponding fields in the table with the utf8, change to be the same with respect to ok, I also attribute does not match, use the varchar to binding int, it is ok to change back to int, CodePudding user response:
1, the two list to set the primary key and foreign key fields of data types or data length is not the same as 2, a table has a record CodePudding user response:
Solve the building Lord? I also encountered the same problem CodePudding user response:
I also encountered this problem, for a long time, then I set the delete and update all the same good CodePudding user response:
reference AAA123524457 reply: 3/f Quote: refer to 1st floor u013495762 response: Error mean cannot create code constraints, carefully check the data type of the field, such as whether the same with the table, I met this problem, it is just because of the different coding, I use of sjis and correlation of the corresponding fields in the table with the utf8, change to be the same with respect to ok, I also attribute does not match, use the varchar to binding int, it is ok to change back to int, Resolved: 1, check the table format is the same, I watch needs to utf-8 mdb4, 2, put the int into varchar and then change back int, CodePudding user response:
refer to 6th floor qq_36738671 response: I also encountered this problem, for a long time, then I set the delete and update all the same good I also am this problem, the same it is good to get into, but why do you want to change to the same? Seek guidance CodePudding user response:
Because car_testt table with usert table setting all the attributes of value is not null!! (highlight: no empty) Outside the set key, will be deleted when the set null to cascade is ok, because cannot be null!! Hope to adopt ~ CodePudding user response:
I also encountered the problem first throw conclusion caused by different turns out to be the InnoDB database ENGINE, is now a MyISAM is associated not only on foreign keys, this is just a kind of circumstance, can on the command line SHOW ENGINE InnoDB STATUS \ G, see the specific reason, otherwise left to future generations CodePudding user response:
A database table records need to empty