MySQL #1064 - 你的 SQL 语法有错误

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/10389790/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-31 13:11:59  来源:igfitidea点击:

#1064 - You have an error in your SQL syntax

mysql

提问by user1366593

I am trying to set up tables according to the instructions within my software. This is what I entered:

我正在尝试根据我的软件中的说明设置表格。这是我输入的:

CREATE TABLE `swd_account` (
`pk_account` int(11) NOT NULL auto_increment,
`name` char(16) NOT NULL default '',
`isact` tinyint(4) NOT NULL default '1',
PRIMARY KEY (`pk_account`)
) TYPE=MyISAM;

CREATE TABLE `swd_user` (
`pk_user` int(11) NOT NULL auto_increment,
`fk_account` int(11) NOT NULL default '0',
`email` varchar(40) NOT NULL default '',
`name` varchar(40) default NULL,
`isact` tinyint(4) NOT NULL default '1',
`datereg` date default NULL,
`days` tinyint(4) default '0',
`datelastsend` date default NULL,
`messlastsend` int(11) default NULL,
`countsend` int(11) NOT NULL default '0',
`undelivered` tinyint(4) default NULL,
PRIMARY KEY (`pk_user`),
KEY `fk_account` (`fk_account`,`email`,`isact`),
KEY `email` (`email`)
) TYPE=MyISAM;

And this is the message I get back:

这是我收到的信息:

Error
SQL query:

CREATE TABLE  `swd_account` (

 `pk_account` INT( 11 ) NOT NULL AUTO_INCREMENT ,
 `name` CHAR( 16 ) NOT NULL DEFAULT  '',
 `isact` TINYINT( 4 ) NOT NULL DEFAULT  '1',
PRIMARY KEY (  `pk_account` )
) TYPE = MYISAM ;

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 'TYPE=MyISAM' at line 6 

Any suggestions on what could be wrong would be GREATLY appreciated.

任何关于可能出错的建议将不胜感激。

回答by Mahn

It would help if you pointed out which version of MySQL you are using, but assuming it is 5.x, replacing TYPEwith ENGINE(ie ENGINE=MYISAM) should do the trick. This is because TYPE is deprecated in newer versions of MySQL and no longer used.

如果您指出您使用的是哪个版本的 MySQL 会有所帮助,但假设它是 5.x,将TYPE替换为ENGINE(即 ENGINE=MYISAM)应该可以解决问题。这是因为 TYPE 在较新版本的 MySQL 中已弃用,不再使用。

回答by Andrew

I bet they meant ENGINE = MyISAM.

我打赌他们的意思是ENGINE = MyISAM