Björn Hansson Precis som i framtiden

28Aug/120

Mysqldump server to server

Some Mysqldump kung fu to copy data between 2 servers. Very handy if you have limited disk space and needs to move lots of data.

From localhost to remote host #2:
mysqldump -v -N -u username -p'password' --databases db1 db2 | mysql -C -h hostnr2 -u root -p'password'

Through SSH:
mysqldump -v -u username -p'password' --databases db-name | ssh -C [email protected] mysql -u root -p'password'

Compress to gzip:
mysqldump -v -u username -p'password' --databases db-name | gzip -9 > dump.sql.gz

Add more -vv to mysqldump for increased verbosity. -C, --compress Use compression in server/client protocol.

Downside if the connection dies, which seems to happen quite a lot over distances, you have to start over from beginning (or specify tables) 🙁

  • Delicious
  • Facebook
  • Digg
  • Reddit
  • StumbleUpon
  • Twitter
Kommentarer (0) Trackbacks (0)

Ännu inga kommentarer


Kommentera

Inga trackbacks ännu.