Linux backs up mysql Data every day

Source: Internet
Author: User
Tags vps

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!

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.