0

Background Information

While doing a backup / restore with mysql, I noticed that the restored database was missing a bunch of tables.

Code:

To create the dump file, this is the command that is being used:

mysqldump --databases widgetdb --master-data -u username -ptest --add-drop-database --extended-insert > /var/test/dump.db

Then we are trying to restore the database onto a different server using the following command:

mysql --user=username--password=test widgetdb < /var/test/dbdump.db

So I've checked the dump file and I searched for a table that's missing in the restored database. This is what the code looks like:

DROP TABLE IF EXISTS `widget1`;
/*!50001 DROP VIEW IF EXISTS `widget1`*/;
SET @saved_cs_client     = @@character_set_client;
SET character_set_client = utf8;
/*!50001 CREATE TABLE `widget1` (
  `id` tinyint NOT NULL,
  `name` tinyint NOT NULL,
  `label` tinyint NOT NULL,
  `objtype_id` tinyint NOT NULL,
  `asset_no` tinyint NOT NULL,
  `has_problems` tinyint NOT NULL,
  `comment` tinyint NOT NULL
) ENGINE=MyISAM */;
SET character_set_client = @saved_cs_client;

I found the following post: MySQL dump file and commented out lines

This seems to indicate then that the commented out lines will still be run. In my case, I'm running mysql version 5.5.35 which is higher than 50001... But the table isn't created for me when I restore the dump file.

What I've Tried So Far:

I've tried to change the command use to create the dump file so that I use the --opt option in an attempt to use the "defaults". The restored database is still missing tables.

Community
  • 1
  • 1
dot
  • 14,928
  • 41
  • 110
  • 218
  • Which half of the tables are missing? Does it get to a certain point in the dump and stop, or is it just some tables randomly missing? – Rob Jan 30 '14 at 20:52
  • 1
    Have you looked in the dump file to see if it contains the missing tables? That will help you narrow down the problem to either the export or import – Martin Wilson Jan 30 '14 at 20:54
  • @Rob good point. I compared both database (source and dest) visually using phpmyadmin and I see that it's missing tables from a specific point onwards. So then i checked the dump file and the tables are missing from there. So the problem is with database creation i guess – dot Jan 30 '14 at 21:04
  • @MartinWilson, please see my Edit 1 section in post – dot Jan 30 '14 at 21:08
  • Maybe you should rewrite this question now that you know the problem is with your use of mysqldump rather than your restore process – Martin Wilson Jan 30 '14 at 21:14

0 Answers0