Search code examples
mysqlsqlsqlyog

Error 1064 when trying to create a table


Here is the code:

create table `team`.`User`( 
   `UserID` bigint NOT NULL AUTO_INCREMENT , 
   `Username` text(30) NOT NULL , 
   `Email` text(30) NOT NULL , 
   PRIMARY KEY (`UserID`)
 )  Engine= [default] comment='' row_format=Default  

And the error message:

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
'[default] comment='' row_format=Default' at line 6

Can someone tell me why I'm getting this error and how to fix it?

EDIT: This code was automatically generated by SQLyog. It seems that the Engine bit is causing the problem. Does anyone know how to use SQLyog to set the default engine?


Solution

  • As far as I know, square brackets don't have any special meaning in MySQL. You're probably confused with some other DBMS.

    Valid syntax for the ENGINE keyword is ENGINE [=] engine_name. E.g.:

    ENGINE=InnoDB
    

    ... or

    ENGINE InnoDB
    

    If you don't care about the storage engine, remove the clause and MySQL will use the default.