Mysql – What’s the fastest way to execute a MySQL Dump of a large Database

MySQLmysql-5.6mysqldumpnavicat

I currently have a rather large database that I create dumps from the our websites Live Server to my Test Server (and vice versa).

Creating the dump is fairly quick (takes about 30 seconds). However, executing the dump file on my Test Server (or Live Server) in order to setup a copy of the dumped database takes AGES (roughly 2-4 hours).

Is there anyway to make this faster? I currently generate the MySQL Database Dumps using Navicat, and then execute them again using Navicat.

Best Answer

Set up the OS with LVM Snapshots. Preferably have MySQL in a separate partition or drive that is to be snapshotted. Then to take a dump:

  • Stop mysqld
  • take snapshot (a minute or so, regardless of dataset size)
  • start mysqld

Copy (suggest rsync) the snapshot to the other machine (this takes time) into an identical snapshot area.

  • start mysqld

(Caveat: I have never tried this, so there could be some rough edges.)