Daily backup of mysql database script _ MySQL

Source: Internet
Author: User
1 .#! Binsh2.cdhomemysql-backup3.rmalldb.5.tar.gz-f4.mvalldb.4.tar.gzalldb.5.tar.gzdevnull215.mvalldb.3.tar.gzalldb.4.tar.gzdevnull216.mvalldb.2.tar.gzalldb.3.tar.gz devnull217.mvalldb. 1 1 .#! /Bin/sh
2. cd/home/mysql-backup
3. rm alldb.5.tar.gz-f
4. mv alldb.4.tar.gz alldb.5.tar.gz>/dev/null 2> & 1
5. mv alldb.3.tar.gz alldb.4.tar.gz>/dev/null 2> & 1
6. mv alldb.2.tar.gz alldb.3.tar.gz>/dev/null 2> & 1
7. mv alldb.1.tar.gz alldb.2.tar.gz>/dev/null 2> & 1
8. mv alldb.0.tar.gz alldb.1.tar.gz>/dev/null 2> & 1
9. tar zcf alldb.0.tar.gz alldb. SQL>/dev/null 2> & 1
10. rm alldb. SQL-f
11. mysqldump-all-databases-opt-ppassword> alldb. SQL

In the last sentence above-the password of ppassword indicates the password of the root account. change it to the password of the root account of your own database, alternatively, you can create a backup user to replace the root account. In addition, make sure that the/home/mysql-backup directory exists. Finally, change the script attribute to 755, and the owner is root. root, put it in/etc/cron. in the daily directory, you can back up the database once a day and cycle it every week. If dual-Machine backup is added, the system is more secure.

The same method can be used to back up website content and dns databases.

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.