SQL query is not working on phpMyAdmin as I am getting an error(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 上不起作用,因为我收到错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:SQL 查询在 phpMyAdmin 上不起作用,因为我收到错误
基础教程推荐
- SQL Server 实例在登录协商期间返回无效或不受支持的协议版本 2021-01-01
- SQL:使用来自具有相同列名的两个表中的数据... 2021-01-01
- 需要 MySQL 5.1 中的抽象触发器来更新审计日志 2021-01-01
- 是否可以执行按位分组功能? 2021-01-01
- 将 SQL Server DateTime 列迁移到 DateTimeOffset 2021-01-01
- 无法解决整理冲突 2021-01-01
- SSMS 中的权限问题:“对象 'extended_properties'、数据库 'mssqlsystem_resource'、... 错误 229)上的 SELECT 权限被拒绝" 2022-01-01
- SQL 效率:WHERE IN 子查询 vs. JOIN 然后 GROUP 2021-01-01
- 在 SQL 中连接多个表 2021-01-01
- 如何使用 mysql.connector 禁用查询缓存 2022-01-01
