MySQL database dam from a remote host without a temporary file

I am trying to implement a cron database backup (other solutions are welcome) in my work, but I have a little problem:

I have a large database of more than 10 GB in space, and the current version of vm has no place to store it in a temporary file that mysql creates.

I know that I can use mysqldump with the host parameter, but my question is whether the temporary file generated by mysqldump remains on the machine that starts it, or does it remain on the database server?

UPDATE : I forgot to mention that I am trying to back up a network of websites and that some of them are behind the firewall (VPN access is required), and some need a server to get to the database server.

+4
source share
2 answers

You can run the shell script from the archive host, where you passed the keys with the database server without the ssh key. This allows you to transfer the file directly via ssh without creating temporary files on the remote database server:

ssh -C myhost.com mysqldump -u my_user --password=bigsecret \ 
  --skip-lock-tables --opt database_name > local_backup_file.sql

, , , , . , , 3306 .

, " ", , ​​ .

ssh me@remoteserver 'mysqldump -u user -psecret production_database | \
  gzip -9' | gzip -d | mysql local_database

ssh -C, gzip-.

+1
0

Source: https://habr.com/ru/post/1628108/


All Articles