HiveBrain v1.2.0
Get Started
← Back to all entries
patternsqlMinor

Moving MySQL Cold Backup to Another DB Server

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
coldmysqlmovinganotherserverbackup

Problem

I am new to MySQL and want to know the info whether taking a cold backup from source and copying it onto new server with same version require any additional configurations settings to be changed.

As I have gone through few of the tutorials, none of the config changes are required.

Steps I am following

  • Shutting down source server



  • copying the backup (/var/lib/mysql).



  • importing backup to new server (/var/lib/mysql).



  • Start the new server.



Thanks in advance

Solution

You missed three(3) things

  • On DB1, mysql -uroot -ppassword -e"SET GLOBAL innodb_fast_shutdown = 0"



  • On DB1, service mysql stop (DB1)



  • Copying the backup (/var/lib/mysql) on DB1



  • Copy /etc/my.cnf on DB1 to /etc folder on DB2



  • Importing DB1 backup to DB2 (/var/lib/mysql)



  • 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

Give it a Try !!!

Context

StackExchange Database Administrators Q#48198, answer score: 6

Revisions (0)

No revisions yet.