尝试创建表时出现错误1064

时间:2012-07-05 09:42:22

标签: mysql sql sqlyog

以下是代码:

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  

错误信息:

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

有人可以告诉我为什么我会收到此错误以及如何解决此问题?

编辑:此代码由SQLyog自动生成。似乎引擎位导致了问题。有谁知道如何使用SQLyog设置默认引擎?

4 个答案:

答案 0 :(得分:2)

如果您想使用默认引擎,则应尝试删除Engine= [default]部分 您的查询应该是

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

答案 1 :(得分:1)

Engine= [default],请尝试使用Engine= MyISAM

答案 2 :(得分:1)

据我所知,方括号在MySQL中没有任何特殊含义。您可能与其他一些DBMS混淆。

ENGINE关键字的{p> Valid syntaxENGINE [=] engine_name。 E.g:

ENGINE=InnoDB

......或

ENGINE InnoDB

如果您不关心存储引擎,请删除该子句,MySQL将使用默认值。

答案 3 :(得分:-1)

您的创建查询是错误的。 请查看手册and what is the correct syntax for ENGINE

相关问题