PhpMyAdmin 导出不包括 PRIMARY KEY 作为 mysqldump [英] PhpMyAdmin export does not include PRIMARY KEY as mysqldump

查看:31
本文介绍了PhpMyAdmin 导出不包括 PRIMARY KEY 作为 mysqldump的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

导出与PhpMyAdmin同表的结构:

Export of the struture of the same table with PhpMyAdmin:

`DROP TABLE IF EXISTS `test_apprentis`;
CREATE TABLE IF NOT EXISTS `test_apprentis` (
  `a_id` smallint(10) NOT NULL,
  `a_promo_id` smallint(11) NOT NULL,
  `a_cursus` smallint(10) DEFAULT NULL
) ENGINE=MyISAM AUTO_INCREMENT=3665 DEFAULT CHARSET=utf8;`

Export with mysqldump:

DROP TABLE IF EXISTS `test_apprentis`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `test_apprentis` (
  `a_id` smallint(10) NOT NULL AUTO_INCREMENT,
  `a_promo_id` smallint(11) NOT NULL,
  `a_cursus` smallint(10) DEFAULT NULL,
  PRIMARY KEY (`a_id`)
) ENGINE=MyISAM AUTO_INCREMENT=3665 DEFAULT CHARSET=utf8;

使用 PhpMyAdmin,没有 AUTO_INCREMENT 和 PRIMARY KEY为什么?

With PhpMyAdmin, there is no AUTO_INCREMENT nor PRIMARY KEY Why ?

推荐答案

这不是一个愚蠢的问题,phpMyAdmin 过去常常在 CREATE TABLE 语句的末尾包含 KEY,并将它们的特性包含在列名声明旁边.按照他们的 2014 更改日志,在 4.2.0.0 (2014) 版之后-05-08) 导出文件结构已更改:

It is not a silly question, phpMyAdmin used to include the KEYs at the end of the CREATE TABLE statement and their characteristics right next to their column name declaration. Following their 2014 changes log, after version 4.2.0.0 (2014-05-08) the export file structure was changed:

  • rfe #1004 在 SQL 导出的末尾创建索引

所以我们必须查看导出文件的末尾才能找到所有索引信息

So we must look the end of the exported file to find all the indexes info

这篇关于PhpMyAdmin 导出不包括 PRIMARY KEY 作为 mysqldump的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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