开发者

Moving mysql files across servers

I have a massive MySQL database (around 10 GB), and I need to copy it to a different server (slicehost). I don't want to do a DB开发者_如何学JAVA dump and reimport b/c I think that would take forever. Is it possible to just move the raw SQL files from one machine to the next, setup an identical mysql server, and flip the switch?


Generally, yes. It's preferable to have the same underlying architecture and server version, but those aren't critically necessary. Make sure you stop the source server so that the raw files are a consistent copy.

I do this all the time when overwriting my dev database. We have backups on a replica that are made from tarring up /var/mysql when the server is stopped. I move those to another machine, overwrite iblog and ibdata, then overwrite all the directories in data except for mysql and test.


It should work.

This is the principle that the mysqlhotcopy tool uses, although this tool is meant to be run while the server is operating.


You don't have a "massive" database, you have a smallish database at 10G. So dump/restore should not be a problem.

Copying the files directly might work in a subset of circumstances, but dump/restore is much better (i.e. less chance of problems).

Clearly, try it on a non-production system with the same version(s) of mysql and data size first to ensure that it's going to work on production.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜