mysqldump on remote server

不打扰是莪最后的温柔 提交于 2019-12-02 02:27:41

问题


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..


回答1:


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




回答2:


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)




回答3:


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.




回答4:


  • 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)



回答5:


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.



来源:https://stackoverflow.com/questions/2963624/mysqldump-on-remote-server

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!