mysqldump错过了表数据

时间:2015-11-18 12:59:17

标签: mysql unix mysqldump

我想完全转储我的数据库。所以我用了......

mysqldump -h <host> -u <user> -p<password> -q --single-transaction --triggers --routines --compress <database> > dump.sql

...将我的数据转储到文件(4.271.663.366 Bytes&gt; 3,97GB)。我为我的表找到了一个create语句,但没有插入数据。 如果我将表单独转储到文件中,则一切正常。

这里有一些信息:

数据库信息:

  • 表数:215
  • 记录:32105706
  • Typ:InnoDB(some MyIsam)
  • 尺寸:6.5 GiB

有问题的表格:

  • 记录:31178
  • Typ:InnoDB
  • 尺寸:12.5 MiB

创建此表的语句(仅使用phpmyadmin export - &gt;结构创建):

CREATE TABLE IF NOT EXISTS `<table-name>` (
  `<field>` mediumint(11) unsigned NOT NULL AUTO_INCREMENT,
  `<field>` varchar(64) NOT NULL,
  `<field>` varchar(64) NOT NULL,
  `<field>` varchar(2) NOT NULL,
  `<field>` varchar(8) NOT NULL,
  `<field>` varchar(8) NOT NULL,
  `<field>` int(2) unsigned NOT NULL,
  `<field>` int(2) unsigned NOT NULL,
  `<field>` int(2) unsigned NOT NULL,
  `<field>` int(2) unsigned NOT NULL,
  `<field>` int(2) unsigned NOT NULL,
  `<field>` int(2) unsigned NOT NULL,
  `<field>` int(2) unsigned NOT NULL,
  `<field>` int(2) unsigned NOT NULL,
  `<field>` int(2) unsigned NOT NULL,
  `<field>` varchar(50) NOT NULL,
  `<field>` tinyint(4) NOT NULL DEFAULT '0',
  `<field>` varchar(35) NOT NULL,
  `<field>` datetime DEFAULT NULL,
  `<field>` varchar(70) DEFAULT NULL,
  `<field>` datetime DEFAULT NULL,
  `<field>` varchar(70) DEFAULT NULL,
  `<field>` datetime DEFAULT NULL COMMENT '<comment>',
  `<field>` tinyint(1) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`<field>`),
  UNIQUE KEY `<field>` (`<field>`),
  KEY `<field>` (`<field>`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=10500127 ;

--
-- Trigger `<field>`
--
DROP TRIGGER IF EXISTS `<table-trigger>`;
DELIMITER //
CREATE TRIGGER `<table-trigger>` BEFORE DELETE ON `<table-name>`
 FOR EACH ROW BEGIN
  SET @DISABLE_TRIGER_other_trigger=1;
  DELETE FROM <other-table> WHERE <field> = OLD.<field>;
  DELETE FROM <other-table> WHERE <field> = OLD.<field>;  
  DELETE FROM <other-table> WHERE <field> = OLD.<field>;
  DELETE FROM <other-table> WHERE <field> = OLD.<field>;
  DELETE FROM <other-table> WHERE <field> = OLD.<field>;
  DELETE FROM <other-table> WHERE <field> = OLD.<field>;
  DELETE FROM <other-table> WHERE <field> = OLD.<field>;
  DELETE FROM <other-table> WHERE <field> = OLD.<field>;
  DELETE FROM <other-table> WHERE <field> = OLD.<field>;
  SET @DISABLE_TRIGER_other_trigger=NULL;
END
//
DELIMITER ;

的MySQL转储: mysqldump --version

  

mysqldump Ver 10.13 Distrib 5.5.46,debian-linux-gnu(x86_64)

有人有想法吗?

1 个答案:

答案 0 :(得分:0)

mysqldump -u <USER> -p <db_name> > mysqldump.sql

并使用

导入

mysql -u <USER> -p <db_name> < mysqldump.sql

为我做了诀窍。希望它有所帮助。