I am using mysqldump to move my database to another sever. But database has tables with million of rows and mysql restore takes too long(4 houres).
is there any way I do this faster?
Asked
Active
Viewed 266 times
0

Mehdi Azizi
- 187
- 2
- 10
-
I guess you could just copy over some of the contents of /var/lib/mysql, though I don't know how much system specific information is stored in there... – opatut Feb 07 '13 at 00:21
-
I think It is not safe. risky – Mehdi Azizi Feb 07 '13 at 00:24
-
right! copy your mysql database folder, don't forget to copy the files from the lib/mysql folder that contains an inno db if you use any. Afterwards just run a repair/optimize over the tables and it should work (worked for me every time!) – itsid Feb 07 '13 at 00:25
-
What does that mean for you? Either it works or it does not - try it out. I cannot think of any security problems if you only copy over your database, not the whole user and permission information. – opatut Feb 07 '13 at 00:25
2 Answers
0
Yes, you can kill the mysqld on the source server, once it is down you can copy the entire datadir to the new server and start both servers once copy is done.

Adi
- 1,026
- 7
- 5
0
Here's the way I have done this in the past using mysql replication
Dump SQL on source machine with binary logging turned on (use the --master-data
option) this will give you data at that point in time and allow you to import the data on your new server while new data is being populated on the old server.
after the import (4 hours you said?) then you can START SLAVE
on the new server and the new server will replay the binary logs and catch up to the old server and keep in sync until the actual switchover happens.

Geek Num 88
- 5,264
- 2
- 22
- 35