Question

I am trying to forward engineer a Workbench database like I have been doing. This time was different though, instead of working normally it gave me a strange error.

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

I tried searching what errno -1 was but no luck. Anyone have a clue what this error message is trying to tell me?

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;

There are other parts to it but it can't even get past ANY table creation. Also changed DB name, quite sure I spelled it correctly.

Was it helpful?

Solution

I simply removed the database. and run your query on SQL Fiddle and it works:

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;

Give a look at InnoDB Error Codes as it says:

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. 
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top