简体   繁体   中英

mysqldump misses table data

I want to make a full-dump of my databases. So I used ...

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

... to dump my data to a file (4.271.663.366 Bytes > 3,97GB). I find a create statement for my table, but no insert data. If I dump the table separate into a file, all works.

Here some info:

Database info:

  • Table count: 215
  • Records: 32105706
  • Typ: InnoDB (some MyIsam)
  • Size: 6.5 GiB

The table with problems:

  • Records: 31178
  • Typ: InnoDB
  • Size: 12.5 MiB

Create Statement of this table (created with phpmyadmin export -> structure only):

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-Dump: mysqldump --version

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

Has anyone an idea?

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

and import using

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

does the trick for me. Hope it helps.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM