When you use navicat v8.0 to create a database, the foreign key error 1005: Can't create table (errno: 121) is returned)

Source: Internet
Author: User

error 1005: Can't create table (errno: 121)

Errno 121 means a duplicate key error. Probably the table already exists in the InnoDB internal data dictionary, though the. frm file for the table has been deleted. This is
Most common reason for getting errno 121 in Table creation. Another possible reason is a name conflict in a foreign key constraint name. constraint names must be unique in a database, like table names are.


Meaning:

1. Duplicate table names

2. The table named after this name was previously created and deleted, but the corresponding. frm file remains on the disk.

3. The primary key name is not unique throughout the database.

 

This is the third case -----The primary key name is not unique throughout the database.

When setting the foreign key, the foreign key name has already been used in another table, which leads to the '123' error. After the foreign key name is changed, the table is created successfully.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.