Skip to content

Instantly share code, notes, and snippets.

@tuksik
Last active August 31, 2015 14:08
Show Gist options
  • Save tuksik/e3f53ab9f5baea8d1ebf to your computer and use it in GitHub Desktop.
Save tuksik/e3f53ab9f5baea8d1ebf to your computer and use it in GitHub Desktop.
Moving MySQL Cold Backup to Another DB Server

http://dba.stackexchange.com/questions/48198/moving-mysql-cold-backup-to-another-db-server

  1. On DB1, mysql -uroot -ppassword -e"SET GLOBAL innodb_fast_shutdown = 0"
  2. On DB1, service mysql stop (DB1)
  3. Copying the backup (/var/lib/mysql) on DB1
  4. Copy /etc/my.cnf on DB1 to /etc folder on DB2
  5. Importing DB1 backup to DB2 (/var/lib/mysql)
  6. On DB2, chown -R mysql:mysql /var/lib/mysql

Start mysql on DB2

Step 1 flushes everything InnoDB not yet committed to disk. That makes for a faster mysql startup.

From here, you have the option of changing settings

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment