OK I am importing a database from another server. I keep getting this error: Incorrect table definition; there can be only one auto column and it must be defined as a key It's doing that because every table in the mysql dump has an auto_increment ID column in it. Example 1st table: CREATE TABLE ads ( id int(10) NOT NULL auto_increment, name varchar(150) NOT NULL, ads_code text NOT NULL, remarks text NOT NULL, active_status enum('0','1') DEFAULT '1' NOT NULL, numofseen int(10) DEFAULT '0' NOT NULL, PRIMARY KEY (id) ); Other Tables: DROP TABLE IF EXISTS announcement; CREATE TABLE announcement ( id int(11) NOT NULL auto_increment, flag enum('0','1') DEFAULT '1' NOT NULL, text text NOT NULL ); DROP TABLE IF EXISTS categories; CREATE TABLE categories ( id int(10) NOT NULL auto_increment, name varchar(100) NOT NULL, display_name varchar(100), description varchar(200) NOT NULL, active_status enum('1','0') DEFAULT '1' NOT NULL, position int(10) DEFAULT '0' NOT NULL ); $10 to anyone who can help me successfully import this database or tell me how I can fix this.
Try.. CREATE TABLE ads( id int(10) NOT NULL auto_increment, PRIMARY KEY(id), name varchar(150) NOT NULL, ads_code text NOT NULL, remarks text NOT NULL, active_status enum('0','1') DEFAULT '1' NOT NULL, numofseen int(10) DEFAULT '0' NOT NULL ); DROP TABLE IF EXISTS announcement; CREATE TABLE announcement ( id int(11) NOT NULL auto_increment, PRIMARY KEY(id), flag enum('0','1') DEFAULT '1' NOT NULL, text text NOT NULL ); DROP TABLE IF EXISTS categories; CREATE TABLE categories ( id int(10) NOT NULL auto_increment, PRIMARY KEY(id), name varchar(100) NOT NULL, display_name varchar(100), description varchar(200) NOT NULL, active_status enum('1','0') DEFAULT '1' NOT NULL, position int(10) DEFAULT '0' NOT NULL );
Agent_Smith's queries are right. Just to clear the things, you must have to define the auto_increment column as Primary key.