CREATE TABLE 中的 1064 错误... TYPE=MYISAM

2021-11-20 00:00:00 syntax mysql

这是我的错误(如果您需要更多信息,请询问)-错误SQL查询:

Here is my error(if you need any more info just ask)- Error SQL query:

CREATE TABLE dave_bannedwords(

id INT( 11 ) NOT NULL AUTO_INCREMENT ,
word VARCHAR( 60 ) NOT NULL DEFAULT  '',
PRIMARY KEY ( id ) ,
KEY id( id )
) TYPE = MYISAM ;

MySQL 说:

1064 - 您的 SQL 语法有错误;检查与您的 MySQL 服务器版本相对应的手册以了解要使用的正确语法在第 6 行的TYPE=MyISAM"附近

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

推荐答案

CREATE 下所述TABLE 语法:

注意
旧的 TYPE 选项与 ENGINE 同义.TYPE 在 MySQL 4.0 中被弃用,并在 MySQL 5.5 中删除.升级到 MySQL 5.5 或更高版本时,您必须将依赖 TYPE 的现有应用程序转换为使用 ENGINE.

Note
The older TYPE option was synonymous with ENGINE. TYPE was deprecated in MySQL 4.0 and removed in MySQL 5.5. When upgrading to MySQL 5.5 or later, you must convert existing applications that rely on TYPE to use ENGINE instead.

因此,您想要:

CREATE TABLE dave_bannedwords(
  id   INT(11)     NOT NULL AUTO_INCREMENT,
  word VARCHAR(60) NOT NULL DEFAULT '',
  PRIMARY KEY (id),
  KEY id(id) -- this is superfluous in the presence of your PK, ergo unnecessary
) ENGINE = MyISAM ;

相关文章