I've developed a little script over the years that dumps production databases, and loads them locally on demand, and its been very handy.

However, it was taking ages to load a database on a Virtualbox ubuntu environment I use for debugging with Zend.

A quick look into it, and I found that i'd put

--skip-extended-insert
on the mysqldump command sometime in the past.

I changed that to

--add-locks --extended-insert
and the loading has gone from over 12 hours (I was asleep, not waiting for it ;-) down to 30 minutes.

Thats a significant speedup!

While in there I added a progress meter using the pv command, the code looks like this:

FILESIZE=$(stat -c%s $TEMPDIR/$DRUPAL_DB.sql)
cat $TEMPDIR/$DRUPAL_DB.sql | pv -s$FILESIZE | $MYSQLPATH/mysql -u$DRUPAL_USER -p$DRUPAL_PASS $DRUPAL_DB 

Maybe you can use that snippet yourself, or even better, utilise the excellent drush command for Drupal, which has a similar ability.

Topics