MySQL错误代码1005 errno -1

时间:2013-03-01 07:41:07

标签: mysql mysql-error-1005

我正在尝试像我一直在做的那样设计一个Workbench数据库。这个时间虽然不同,但不是正常工作,它给了我一个奇怪的错误。

Error Code: 1005. Can't create table '~~~~~~~~~~~~~~~~~~~' (errno: -1)

我试着搜索errno -1是什么但没有运气。任何人都知道这个错误消息试图告诉我什么?

CREATE  TABLE IF NOT EXISTS `database`.`User` (

`Uid` MEDIUMINT UNSIGNED NOT NULL AUTO_INCREMENT ,

`Username` VARCHAR(45) NOT NULL ,

`Password` TINYTEXT NOT NULL ,

`Avatar` TINYTEXT NULL ,

`Status` CHAR(6) NOT NULL DEFAULT 'Active' COMMENT 'Active, Warned, Banned' ,

 PRIMARY KEY (`Uid`) )

  ENGINE = InnoDB;

还有其他部分,但它甚至无法通过任何表格创建。还更改了DB名称,我确信拼写正确。

1 个答案:

答案 0 :(得分:3)

我只是移除了database.并在SQL Fiddle上运行了您的查询,但它确实有效:

CREATE  TABLE IF NOT EXISTS `User` (

`Uid` MEDIUMINT UNSIGNED NOT NULL AUTO_INCREMENT ,

`Username` VARCHAR(45) NOT NULL ,

`Password` TINYTEXT NOT NULL ,

`Avatar` TINYTEXT NULL ,

`Status` CHAR(6) NOT NULL DEFAULT 'Active' COMMENT 'Active, Warned, Banned' ,

 PRIMARY KEY (`Uid`) )

  ENGINE = InnoDB;

请看InnoDB Error Codes,因为它说:

Error 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.