Hulk
Hulk

Reputation: 34200

mysqldump on remote server

If there are two machines client and server .From client how to do a mysqldump to the server such that the dump is avaliable on the client and not stored in the server

Thanks..

Upvotes: 2

Views: 2200

Answers (5)

Mauritz Hansen
Mauritz Hansen

Reputation: 4774

See the answer to similar question elsewhere:

https://stackoverflow.com/a/2990732/176623

In short, you can use mysqldump on the client to connect to and dump the server data directly on the client.

Upvotes: 0

tylerl
tylerl

Reputation: 30867

Here is a PHP script that generates a mysqldump. It outputs directly to the client, and does not create any files on the server.

https://github.com/tylerl/web-scripts/tree/master/mysqldump

Upvotes: 1

Konerak
Konerak

Reputation: 39773

  • Either you do the backup serverside (if you have access to the server), using mysqldump to dump it, gzip or bzip2 to zip the file, and ftp/sftp/scp to transfer the file to the client afterwards. You can later script this, and afterwards crontab it to have it run automatically each X time. Checkout logrotate to avoid storing too many backups.
  • Or you use a tool on the client to fetch the data. The default (free) MySQL Workbench can back-up an entire database, or you can select which tables to backup (and interestingly, afterwards which tables to restore - nice if you only need to reset 1 table)

Upvotes: 0

Francisco Soto
Francisco Soto

Reputation: 10392

You could write a simple script, that could run in your crontab to create such dump and move it to some particular area of your file system, like an http accessible folder, or an ftp folder.

Then you could write an script to run in your clients that would fetch such dumps if you need this to be automatic too.

Upvotes: 0

lexu
lexu

Reputation: 8849

Do this in two steps:

  • dump data on server
  • transfer to client (possibly compress first)

If you need to do it often, then write a script on the server that dumps, compresses and copies the data to the client (don't forget to archive/delete old backups on server, as neded)

Upvotes: 0

Related Questions