由于出现错误,SQL查询无法在phpMyAdmin上运行 [英] SQL query is not working on phpMyAdmin as I am getting an error

查看:173
本文介绍了由于出现错误,SQL查询无法在phpMyAdmin上运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已在phpMyAdmin上输入此代码作为SQL查询.我正在尝试创建一个表(这是另一个站点的副本和粘贴的代码)

I have entered this code on phpMyAdmin as an SQL query. I am trying to create a table (this is a copy and pasted code from another site)

   CREATE TABLE `members` (
`id` int(4) NOT NULL auto_increment,
`username` varchar(65) NOT NULL default '',
`password` varchar(65) NOT NULL default '',
PRIMARY KEY (`id`)
) TYPE=MyISAM AUTO_INCREMENT=2 ;
-- 
-- Dumping data for table `members`
--
INSERT INTO `members` VALUES (1, 'john', '1234');

我收到错误

#1064-您的SQL语法有误;请查看与您的MySQL服务器版本相对应的手册以获取正确的语法,以在第6行的'TYPE = MyISAM AUTO_INCREMENT = 2'附近使用

"#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 AUTO_INCREMENT=2' at line 6 "

推荐答案

指定存储引擎应该不是ENGINE:

It should be ENGINE not TYPE to specify the storage engine:

CREATE TABLE `members` (
`id` int(4) NOT NULL auto_increment,
`username` varchar(65) NOT NULL default '',
`password` varchar(65) NOT NULL default '',
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=2 ;

请参见创建表语法:

table_option: 引擎[=] engine_name

table_option: ENGINE [=] engine_name

自MySQL 4.0起,该选项TYPE已在MySQL 5.5中删除:

The option TYPE was removed with MySQL 5.5, deprecated since MySQL 4.0:

较早的TYPE选项是ENGINE的同义词. TYPE为 自MySQL 4.0起不推荐使用,但仍支持向后 在MySQL 5.1中的兼容性(MySQL 5.1.7除外).从MySQL 5.1.8开始, 它会发出警告.在MySQL 5.5中已将其删除.你不应该使用 在任何新应用中输入TYPE,您应该立即开始 将现有应用程序转换为使用ENGINE. (请参阅 MySQL 5.1.8发行说明.)

The older TYPE option was synonymous with ENGINE. TYPE has been deprecated since MySQL 4.0 but is still supported for backward compatibility in MySQL 5.1 (excepting MySQL 5.1.7). Since MySQL 5.1.8, it produces a warning. It is removed in MySQL 5.5. You should not use TYPE in any new applications, and you should immediately begin conversion of existing applications to use ENGINE instead. (See the Release Notes for MySQL 5.1.8.)

来源:创建表,MySQL 5.1

这篇关于由于出现错误,SQL查询无法在phpMyAdmin上运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆