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

查看:168
本文介绍了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,并且它们的特性紧随其列名声明之后.在版本4.2.0.0(2014年之后,遵循他们的 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天全站免登陆