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 the 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.
意思是:
1、表名重复
2、以该名字命名的表之前创建过后来删除了,但是对应的.frm文件还留在磁盘上
3、主键名字在全数据库范围内不是唯一的
今天遇到的应该是第三种情况-----主键名字在全数据库范围内不是唯一的
在设置外键的时候,外键名之前在另外一张表里面已经使用过,这就造成了'121'这个错误。将外键名进行更改后,建表成功。