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.