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.