0

Please help me! I imported a MySQL file with this code:

delimiter $$

CREATE TABLE "login" (
  "IdUser" int(11) NOT NULL AUTO_INCREMENT,
  "username" varchar(45) CHARACTER SET latin1 NOT NULL,
  "pass" varchar(45) CHARACTER SET latin1 NOT NULL,
  PRIMARY KEY ("IdUser")
) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8$$

CREATE TABLE "photos" (
  "IdPhoto" int(11) NOT NULL AUTO_INCREMENT,
  "title" varchar(100) CHARACTER SET latin1 NOT NULL,
  "IdUser" int(11) NOT NULL,
  PRIMARY KEY ("IdPhoto")
) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8$$

....and I get the following error:

MySQL said:

1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'delimiter $$ CREATE TABLE "login" ( "IdUser" int(11) NOT NULL AUTO_INCREME' at line 1

Update:

Problem solved. Thank you for responding!

CREATE TABLE `login` (
  `IdUser` int(11) NOT NULL auto_increment,
  `username` varchar(45) NOT NULL,
  `pass` varchar(45) NOT NULL,
  PRIMARY KEY (`IdUser`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

CREATE TABLE `photos` (
  `IdPhoto` int(11) NOT NULL auto_increment,
  `title` varchar(100) NOT NULL,
  `IdUser` int(11) NOT NULL,
  PRIMARY KEY (`IdPhoto`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ;
Ricky
  • 100
  • 1
  • 1
  • 7

1 Answers1

1

The delimiter command is not a server instruction; rather, it is a client-specific instruction recognised by certain client programmes such as the MySQL command line tool. It has the effect of changing the character that the client programme recognises as delimiting the statements which are to be sent to the server.

In phpMyAdmin, the statement delimiter can be changed in the Delimiter text box before clicking Go.

eggyal
  • 122,705
  • 18
  • 212
  • 237
  • Oh okay. Getting rid of the first line is the solution you're saying ("delimiter $$")? – Ricky Jul 12 '13 at 00:42
  • @user1526521: Yes, but you'll need to inform phpMyAdmin that the delimiter is in fact `$$` in another way; also, be aware that later versions of phpMyAdmin (2.11?) recognise the `delimiter` command so this ceases to be an issue. – eggyal Jul 12 '13 at 00:46