Reputation: 26026
I have a database on a 32bit Linux server with MySQL that I would like to import/copy/migrate to a 64bit Linux server.
I have considered
service mysqld stop
tar czf /root/db.tar.gz /var/lib/mysql
and copy this to the new server.
Or perhaps
mysqldump -uroot -p --all-databases > /root/db.sql
Question
Is that possible, and if so, what the recommended way?
Upvotes: 1
Views: 2573
Reputation: 270727
Using mysqldump
and re-importing the resultant file will work for certain and is recommended, unless your database is very large and the dump/import process' slower speed is an issue.
Unless the server environment is identical in most ways, you may have some cleaning up to do and permissions corrections if you were to copy the data files over directly. There is documentation on performing the transfer with raw data files, but mysqldump
is the usual preferred method.
Upvotes: 3
Reputation: 28752
If you have a large database, I would suggest using XtraBackup. It will likely be much faster than using mysqldump
followed by an import.
Upvotes: 1