SQL 查询在 phpMyAdmin 上不起作用,因为我收到错误

SQL query is not working on phpMyAdmin as I am getting an error(SQL 查询在 phpMyAdmin 上不起作用,因为我收到错误)
本文介绍了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而不是TYPE:

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 ;

参见CREATE TABLE 语法:

table_option:引擎 [=] 引擎名称

table_option: ENGINE [=] engine_name

选项 TYPE 在 MySQL 5.5 中被删除,从 MySQL 4.0 开始弃用:

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

较旧的 TYPE 选项是 ENGINE 的同义词.类型已自 MySQL 4.0 起已弃用,但仍支持向后MySQL 5.1 中的兼容性(MySQL 5.1.7 除外).从 MySQL 5.1.8 开始,它会产生警告.它在 MySQL 5.5 中被删除.你不应该使用在任何新应用程序中键入,您应该立即开始将现有应用程序转换为使用 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 上不起作用,因为我收到错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

Execute complex raw SQL query in EF6(在EF6中执行复杂的原始SQL查询)
Hibernate reactive No Vert.x context active in aws rds(AWS RDS中的休眠反应性非Vert.x上下文处于活动状态)
Bulk insert with mysql2 and NodeJs throws 500(使用mysql2和NodeJS的大容量插入抛出500)
Flask + PyMySQL giving error no attribute #39;settimeout#39;(FlASK+PyMySQL给出错误,没有属性#39;setTimeout#39;)
auto_increment column for a group of rows?(一组行的AUTO_INCREMENT列?)
Sort by ID DESC(按ID代码排序)