Using scheduled tasks in linux to regularly back up mysql database _ MySQL

Source: Internet
Author: User
Using scheduled tasks in linux to regularly back up mysql database bitsCN.com

Using scheduled tasks in linux to regularly back up mysql databases

# Crontab-e

Add a row:

10 05 *** mysqldump-u database user-p password-A/home/back. SQL -- lock-tables = 0

# Wq

Explanation:

Run the mysqldump command at 05:10 every day. Note that-u is followed by no space and the username-p is followed by the password.

Here, the mysqldump command:

Use the specified database user and password.-A indicates that all databases are backed up to the/home/back. SQL file. -- lock-tables does not lock the table during backup.

In this way, at 05:10 every day, the system will back up all the data in the database under the specified database user permission to an SQL file.

Recover data:

Mysql -- default-character-set = utf8 dbname-u username-p password [Database name]

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.