How to back up sites and databases on Linux VPS hosts _linux

Source: Internet
Author: User
Tags vps

Today introduce a simple method for your own VPS backup.

1, the use of Putty login VPS, here is not much introduced.

2, Backup Site Directory:

[Root@www ~][root@www www][root@www www]#     

3, BACKUP database:

Method One: Use phpMyAdmin to back up the database

Method Two: Automatically back up the database using mysqldump timing

  [root  @www www ]  # vi backup-db.sh  #!/bin/sh /bin / Nice -n  /usr /bin /mysqldump -u vpsmysql --password=vpsmysqlpassword Mysqlname -C  | /bin / Nice -n  /bin / gzip -9  > /web /www /db-backup /vps-$  ( date  ' +%y%m%d ' ). sql.gz  RM - RF  /web /www /db-backup /vps-$  ( date + % Y %m %d  D  7 days ago ). sql.gz  #上面语句删除7天前的备份            

The above script-U followed the database user name, –password the database password, followed by the database name, followed by the/web/www/db-backup/is the backup directory.

Add a timed execution task

[Root@www ~]/web/www/backup-db.sh   
Daily 23:59 chapters automatically back up the database, and the resulting database compression is named by date
The above backup of the information, the backup is done quickly to download the backup to the local, after all, the backup data are in the VPS, not around.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.