![]() The local key, foreign table, or column in the constraint references has a typo This can be resolved by either not quoting anything or quoting the table and the column separately. If you wish to diagnose this error, inspect each FOREIGN KEY declaration and ensure that there are no quotes around object qualifiers or that there are quotes around the table and one pair around each column name. SET or indexes in the constraint reference misuse quotes SOURCE /backups/mydump.sql - restore your backup within THIS session ![]() Run the following code to fix the error: SET FOREIGN_KEY_CHECKS=0 It is essential to perform this step during backup restorations in which circular references may be present. The solution is to run the missing CREATE TABLE and try again or temporarily disable foreign-key-checks. Any table that returns an error 1146 indicates that the tables have been created in the incorrect order. Run SHOW TABLES or SHOW CREATE TABLE on each of the parent tables. However, there is no indication that the table does not exist, so it is advised that you use the command to determine what tables are available in the database. Sometimes, the database table customers wish to add constraints does not exist, resulting in a 1215 error message. You will be able to identify your case from the following list: Usually, when loading dumps, the table or index the constraint refers to does not exist In this way, you will gain a better understanding of the problem. In order to determine the cause of this error, it is best to examine the LATEST FOREIGN KEY ERROR section of the SHOW ENGINE INNODB STATUS. How to Fix the MySQL Cannot Add Foreign Key Constraint Error? What Is the Reason for MySQL “#1215 – Cannot Add Foreign Key Constraint” Error?
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |