下面一个简单的创建语句报错, sql error 1005   errno:-1,
查了一下说明文档,没有发现,lumn name that matched the name of an internal InnoDB table
1005 (ER_CANT_CREATE_TABLE)
Cannot create table. If the error message refers to error 150, table creation failed because a foreign key constraint was not correctly formed. If the error message refers to error –1, table creation probably failed because the table includes a column name that matched the name of an internal InnoDB table.CREATE TABLE tt(
Id int primary key,
  nLevel INT 
 )

解决方案 »

  1.   

    mysql> CREATE TABLE tt(
        -> Id int primary key,
        ->   nLevel INT 
        ->  );
    Query OK, 0 rows affected (0.02 sec)
      

  2.   

    有指向此表的外键约束。使用以下语句查询:
     SELECT * FROM information_schema.KEY_COLUMN_USAGE where table_schema='库名' and constraint_name like '%主键名%';
    出现的原因可能是,先创建了从表,之后再创建的子表。
      

  3.   

    show tables;先检查一下已经存在哪些表了。