Moving mysql files on servers
I have a massive MySQL database (about 10 GB) and I need to copy it over to another server (slicehost). I don't want to dump the database and reimport b / c. I think forever. Is it possible to just move raw SQL files from one computer to another, set up an identical mysql server, and flip the switch?
a source to share
It should work.
This is the principle that the mysqlhotcopy tool uses , although the tool is designed to run while the server is running.
a source to share
As a rule, yes. It is preferable to have the same base architecture and server version, but this is not critical. Make sure you stop the source server so that the source files are a consistent copy.
I do this all the time, overwriting my dev database. We have replica backups made from tarring /var/mysql
when the server is stopped. I transfer them to another machine, overwrite iblog
and ibdata
then overwrite all directories in data
except mysql
and test
.
a source to share
You don't have a "massive" database, you have a small 10G database. So dump / restore shouldn't be a problem.
Copying files directly may work in several circumstances, but dump / restore is much better (i.e. less chance of problems).
It is clear to try first on a non-production system with the same mysql version (s) and data size to make sure it will work in production.
a source to share