I'm adding this table:
CREATE TABLE contenttype (
contenttypeid INT UNSIGNED NOT NULL AUTO_INCREMENT,
class VARBINARY(50) NOT NULL,
packageid INT UNSIGNED NOT NULL,
canplace ENUM('0','1') NOT NULL DEFAULT '0',
cansearch ENUM('0','1') NOT NULL DEFAULT '0',
cantag ENUM('0','1') DEFAULT '0',
canattach ENUM('0','1') DEFAULT '0',
isaggregator ENUM('0', '1') NOT NULL DEFAULT '0',
PRIMARY KEY (contenttypeid),
UNIQUE KEY packageclass (packageid, class)
);
And I get a 1050 "table already exists"
But the table does NOT exist. Any ideas?
EDIT: more details because everyone seems to not believe me :)
DESCRIBE contenttype
yields:
1146 - Table 'gunzfact_vbforumdb.contenttype' doesn't exist
and
CREATE TABLE gunzfact_vbforumdb.contenttype(
contenttypeid INT UNSIGNED NOT NULL AUTO_INCREMENT ,
class VARBINARY( 50 ) NOT NULL ,
packageid INT UNSIGNED NOT NULL ,
canplace ENUM( '0', '1' ) NOT NULL DEFAULT '0',
cansearch ENUM( '0', '1' ) NOT NULL DEFAULT '0',
cantag ENUM( '0', '1' ) DEFAULT '0',
canattach ENUM( '0', '1' ) DEFAULT '0',
isaggregator ENUM( '0', '1' ) NOT NULL DEFAULT '0',
PRIMARY KEY ( contenttypeid ) ,
Yields:
1050 - Table 'contenttype' already exists
Your disk also might just be full. (just had that)
from MySQL Log:
I had this same problem and it looks like the Database name was case sensitive. My Database is called:
Whilst my script included
Once I changed the database name to the correct case it all seemed to work. Using MYSQL Workbench on MAC OSX
In my case the problem was that there was a view with the same name as my table, so I had to drop the view to allow the import to continue.
An automated solution that worked for me is to replace the normal drop table with this sed during the dump to also drop any views that might exist:
Or if you would rather print to a file for backup
Or if you received the dumped file and you are importing it to your db
You get the idea
Note: it is important that you add the
^
at the beginning of the replacement regex, because there are other types ofDROP TABLE IF EXISTS
commands in dumps that you don't want to touch.You go from having something like this:
To having something like this:
First check if you are in the right database
USE yourDB
and trySelect * from contenttype
just to see what is it and if it exists really...gosh, i had the same problem with
osCommerce
install script until i figured out the mysql system has many databases and thecreate table
query copies itself into each one and thus droping only the working table on active db didnt help, i had to drop the table from all dbs