Linux backs up MySQL Data every day

Source: Internet
Author: User
Tags vps

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:

Related Article

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.