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?

有帮助吗?

解决方案

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.

其他提示

If you want to use default engine you should try to remove Engine= [default] part.
Your query should be

CREATE TABLE `team`.`User`( 
   `UserID` BIGINT NOT NULL AUTO_INCREMENT , 
   `Username` TEXT(30) NOT NULL , 
   `Email` TEXT(30) NOT NULL , 
   PRIMARY KEY (`UserID`)
 )  comment='' 

Engine= [default], try with Engine= MyISAM, for example.

Your create query is fault. Take a look at the manual and what is the correct syntax for ENGINE

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top