Linux backs up MySQL Data every day
Preface:
If your MySQL database file is large, it may occupy a lot of server resources during backup. Therefore, 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, you must support crontab. If not, refer to my blog: Use Crontab on Linux VPS/server to automate VPS.
Step 2:
Shell script-> mysqlbak. sh
#! /Bin/bash
BACKPATH = 'Storage file Path'
D = 'date + % Y-% m-% d _ % H % M % s'
Name1_1_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!
-------------------------------------- Split line --------------------------------------
Install MySQL in Ubuntu 14.04
MySQL authoritative guide (original book version 2nd) Clear Chinese scan PDF
Ubuntu 14.04 LTS install LNMP Nginx \ PHP5 (PHP-FPM) \ MySQL
Build a MySQL Master/Slave server in Ubuntu 14.04
Build a highly available distributed MySQL cluster using Ubuntu 12.04 LTS
Install MySQL5.6 and Python-MySQLdb in the source code of Ubuntu 12.04
MySQL-5.5.38 universal binary Installation
-------------------------------------- Split line --------------------------------------
This article permanently updates the link address: