Linux backs up mysql Data every day
Preface:
If your database file is large, it may occupy a lot of server resources during backup, so the webmaster should try to select the minimum period of time for the visitor to execute the Automatic Backup command, such as around 4-5 a.m. In addition, pay attention to leave enough time for the backup and then execute the storage command.
Step 1:
First of all to support crontab, if not, please refer to my blog: Linux VPS/server with Crontab to achieve VPS automation http://blog.csdn.net/phpfenghuo/article/details/40828847
Step 2:
Shell script-> mysqlbak. sh
#! /Bin/bashBACKPATH = 'Storage file path' D = 'date ready y-policm-1_d_1_h1_m1_s'name1_d. SQL .gz/usr/local/mysql/bin/mysqldump-u database name-p Database Password specified database -- skip-lock -tables | gzip> $ BACKPATH/$ NAME
Step 3:
Scheduled tasks are executed after every day. Depending on your situation!
Run the following command: crontab-e.
00 02 ***/script path/mysqlbak. sh
Because a server may be suffering from natural disasters, different servers or downloading the backup database files to a local device is more secure. It's actually that simple!