Dump Database

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
leebo
Forum Commoner
Posts: 44
Joined: Sun Oct 20, 2002 9:49 am

Dump Database

Post by leebo »

Hi

I have backed up my mysql database to my hardrive and moving it to another host but when i try and upload it again i get the following error:

CREATE TABLE apart(

town varchar( 100 ) NOT NULL default '0',
sleeps int( 19 ) default '0',
price int( 20 ) default '0',
pool varchar( 8 ) default '0',
beach varchar( 20 ) default '0',
other text NOT NULL ,
picture varchar( 255 ) default '0',
index int( 11 ) NOT NULL auto_increment,
url varchar( 255 ) NOT NULL default '',
type varchar( 50 ) NOT NULL default 'villa',
email varchar( 50 ) NOT NULL default '',
dateadded date NOT NULL default '0000-00-00',
PRIMARY KEY ( index )
) TYPE = MyISAM

MySQL said:


You have an error in your SQL syntax near 'int(11) NOT NULL auto_increment, url varchar(255) NOT NULL default '', type varc' at line 1

Any help will be gratefull
User avatar
Elmseeker
Forum Contributor
Posts: 132
Joined: Sun Dec 22, 2002 5:48 am
Location: Worcester, MA

Post by Elmseeker »

url varchar( 255 ) NOT NULL default '',

try getting rid of the default '' if your gonna default it to be empty it doesn't need to be defaulted at all since if it is left empty when adding to the DB it will remain empty...
leebo
Forum Commoner
Posts: 44
Joined: Sun Oct 20, 2002 9:49 am

Post by leebo »

Thanks but still gives the error :

CREATE TABLE apart(

town varchar( 100 ) NOT NULL default '0',
sleeps int( 19 ) default '0',
price int( 20 ) default '0',
pool varchar( 8 ) default '0',
beach varchar( 20 ) default '0',
other text NOT NULL ,
picture varchar( 255 ) default '0',
index int( 11 ) NOT NULL auto_increment,
url varchar( 255 ) NOT NULL ,
type varchar( 50 ) NOT NULL default 'villa',
email varchar( 50 ) NOT NULL ,
dateadded date NOT NULL default '0000-00-00',
PRIMARY KEY ( index )
) TYPE = MyISAM

MySQL said:


You have an error in your SQL syntax near 'int(11) NOT NULL auto_increment, url varchar(255) NOT NULL , type varchar(50) NO' at line 1

Any more suggestions ?
leebo
Forum Commoner
Posts: 44
Joined: Sun Oct 20, 2002 9:49 am

Post by leebo »

Ok i have sorted it - it was the names of the fields which was giving errors: i changed index to index2 and type to type2 then it worked fine

Thanks anyway
User avatar
Elmseeker
Forum Contributor
Posts: 132
Joined: Sun Dec 22, 2002 5:48 am
Location: Worcester, MA

Post by Elmseeker »

Yeah, Index and type are probably reserved words in MySQL.
Post Reply