quickly copy MySQL InnoDB database without using MySQL dump

For this process We should noted that there must have the same architecture on both machines. I.e. if we have 32 bit on one server then other server would also have 32 bit. But in case if we have 32 bit on one server and 64-bit on another then we will have to use MySQL dump.

mysqldump – MySQL Database Backup and restore program

Backup and Restore Mysql database table

Doing import-export through MySQL dump was taking long time, so I found this easy way to copy/move database for the server same architecture.

Steps are as follows:-

  1. First of all, stop MySQL on both servers (service mysqld stop)
  2. You need to copy several files in your MySQL DB folder. Default path is /var/lib/mysql/
  3. Locate the folder with the name of your database and copy that. I have used highly recommend rsync for copying files between two servers. This would include all the files and folders of mysql directory including ibdata1, ib_logfile0, ib_logfile1, mysql_upgrade_info etc.
  4. Start MySQL (service mysqld start)

Now all done.

Leave a Reply