Suggestions for backing up php site and mysql db

一曲冷凌霜 提交于 2019-12-02 08:53:38

问题


do you have any good suggestions how to backup remote php site and mysql, and upload it to another remote ftp? I do have shell access and it is linux system.

Kind of lame question when I post it like that, but I assume some script would have to be run on remote server with site, that would do this.

If you don't mind sharing your ideas, I would appreciate it.

Best, Zeljko


回答1:


Depends on the capabilities of your shell and the size of your site, but the first step could be very trivial: Use mysqldump and zip it together with your webpage. For uploading your archive you can maybe use wput or simply fall back to ftp which should be available on most shells.




回答2:


Use mysqldump do dump the DB into a "data" directory within the site.
An alternative would be SELECT INTO OUTFILE if you already have the SQL scheme stored somewhere.

Use tar to pack up the website contents.

tar -xvf site.tar

Use FTP, SCP, SFTP, etc to transfer that to the new location, unpack, then depending on how the DB was dumped restore the DB and give it a whirl.




回答3:


Have you tried rsync?

Take a look at the documentation and examples.

Otherwise, I think you should ask this on serverfault.




回答4:


I second rsync but with a helping of mysqldump to dump your databases to a plain text file (assuming the DB is not too large).



来源:https://stackoverflow.com/questions/1056796/suggestions-for-backing-up-php-site-and-mysql-db

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