H
H
Hint2011-05-10 08:59:17
MySQL
Hint, 2011-05-10 08:59:17

How to correctly and quickly transfer a MySQL database from one server to another

There is a MySQL database: a hundred tables (InnoDB and MyISAM), 30 million records, 5 GB.
How to correctly and quickly transfer this database from one server to another?
On the old server MySQL 5.0.51a, on the new 5.1.56.
Is it possible to just copy the files? Or is mysqldump a better standard option?

Answer the question

In order to leave comments, you need to log in

11 answer(s)
S
Sergey, 2011-05-10
@bondbig

mysqldump, yes.

M
marazmiki, 2011-05-10
@marazmiki

The option with mysqldump is quite working. You can also try the method that was used when moving the habr (see the "Base" section)

I
itrabotnik, 2011-05-10
@itrabotnik

I support bondbig
transferred the database to 17GB, mysqldump turned out to be the best option

A
Anton, 2011-05-10
@AntonMinsk

If it is not possible to "stop" the database server during the transfer, you can try to replicate, in the case of mysqldump, there is a chance that the transferred database will not be completely up to date.

V
Vitaly Zheltyakov, 2011-05-10
@VitaZheltyakov

Just copying the files will not work, because. You have InnoDB tables.
Use mysqldump.

N
niko83, 2011-05-10
@niko83

what about LOAD DATA INFILE? - must be fast

L
lazyk, 2011-05-10
@lazyk

I would do the following
: we will lock the tables, we will
copy the data
from the second database with files, we will make a replica , we
will unlock the tables, we will start the
replica
and then we will replace the master at any convenient moment in a matter of seconds

L
lazyk, 2011-05-11
@lazyk

if myisam, then the percon is not a percon, it won’t work without a lock, it’s more correct to remove the backup from the replica, so we don’t load our master in any way and don’t interrupt his work

A
Alexey, 2011-07-26
@alexkbs

For example, like this:
newserver# ssh -C oldserver mysqldump ... | pv | mysql -fbp

S
sevmax, 2011-07-26
@sevmax

With Mysqldump, the database can take a very long time to unfold.
I recommend innobackupex from www.percona.com. Works much more efficiently than native mysqldump

S
Stalker_RED, 2011-07-26
@Stalker_RED

sypex dumper is also a cool thing, fast and works even if there is no ssh access

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question