How to implement daily automatic mysql database backup in linux _ MySQL-mysql tutorial

Source: Internet
Author: User
Tags mysql tutorial
How to implement daily automatic backup of bitsCN.com for mysql databases in linux

How to implement daily automatic mysql database backup in linux

Create a backup folder:

Mkdir mysql_data_bak

Create a script file:

Touch autobackupmysql. sh

Open a file

Vi autobackupmysql. sh

Add the following content to the script:

Filename = 'date + % Y % m % d'

/Usr/bin/mysqldump-uroot-proot boss>/home/mysql_data_bak/$ filename. SQL

Check whether crond is installed. If no, install crond first.

Yum-y install vixie-cron

Yum-y install crontabs

Start service: service crond start

Add boot Auto Start to CentOS: chkconfig -- level 345 crond on

Crontab-e

Added: 00 03 *** source/root/autobackupmysql. sh

Run this file at every morning to back up the database.

Service crond restart

Complete

BitsCN.com

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.