Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Error Code: 1005 -- there is a wrong primary key reference in your code</p> <p>usually it's due to a reference FK field not exist. might be you have typo mistake,or check case it should be same, or there's a field-type mismatch. FK-linked fields must match definitions exactly.</p> <p>Some Known causes may be :</p> <ol> <li>The two key fields type and/or size doesn’t match exactly. For example, if one is <code>INT(10)</code> the key field needs to be <code>INT(10)</code> as well and not <code>INT(11)</code> or <code>TINYINT</code>. You may want to confirm the field size using <code>SHOW</code> <code>CREATE</code> <code>TABLE</code> because Query Browser will sometimes visually show just <code>INTEGER</code> for both <code>INT(10)</code> and <code>INT(11)</code>. You should also check that one is not <code>SIGNED</code> and the other is <code>UNSIGNED</code>. They both need to be exactly the same.</li> <li>One of the key field that you are trying to reference does not have an index and/or is not a primary key. If one of the fields in the relationship is not a primary key, you must create an index for that field.</li> <li>The foreign key name is a duplicate of an already existing key. Check that the name of your foreign key is unique within your database. Just add a few random characters to the end of your key name to test for this.</li> <li>One or both of your tables is a <code>MyISAM</code> table. In order to use foreign keys, the tables must both be <code>InnoDB</code>. (Actually, if both tables are <code>MyISAM</code> then you won’t get an error message - it just won’t create the key.) In Query Browser, you can specify the table type.</li> <li>You have specified a cascade <code>ON</code> <code>DELETE</code> <code>SET</code> <code>NULL</code>, but the relevant key field is set to <code>NOT</code> <code>NULL</code>. You can fix this by either changing your cascade or setting the field to allow <code>NULL</code> values. </li> <li>Make sure that the Charset and Collate options are the same both at the table level as well as individual field level for the key columns.</li> <li>You have a default value (ie default=0) on your foreign key column </li> <li>One of the fields in the relationship is part of a combination (composite) key and does not have it’s own individual index. Even though the field has an index as part of the composite key, you must create a separate index for only that key field in order to use it in a constraint.</li> <li>You have a syntax error in your <code>ALTER</code> statement or you have mistyped one of the field names in the relationship</li> <li>The name of your foreign key exceeds the max length of 64 chars.</li> </ol> <p>for more details refer : <a href="http://verysimple.com/2006/10/22/mysql-error-number-1005-cant-create-table-mydbsql-328_45frm-errno-150/">MySQL Error Number 1005 Can’t create table</a></p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload