MySQL automatic backup tool in Linux-Version 2

Source: Internet
Author: User
Tags mysql automatic backup mysql backup

MySQL automatic backup tool in Linux-the second version is well developed based on the first version (see. It mainly includes custom database hosts and Backup Paths. Multiple databases can be backed up, regardless of the number of databases. You can choose whether to enable expired backup deletion and customize the expiration time. And added more friendly prompts.

Backup Tool usage:

1. Upload mysql. backup (or save the code as mysql. backup) to the Linux Server/usr/local/sbin directory and grant the executable permission.

2. Use vi to open the script and configure the database information. Configure the following information:
Mysql_user = "root" # MySQL backup user
Mysql_password = "root" # password of the MySQL backup user
Mysql_host = "localhost" # host to be backed up, generally localhost
Mysql_port = "3306" # MySQL port number, usually 3306
Backup_db_arr = ("dbachina" "99 yuyu" "cowaw") # Name of the database to be backed up. Separate multiple database names with spaces, for example ("db1" "db2" db3 ")
Backup_location =/backup # backup data storage location. do not include "/" at the end. This option can be used by default. The program will automatically create folders.
Expire_backup_delete = "ON" # Whether to enable expired backup deletion ON whether to enable OFF or disable
Expire_days = 3 # The default expiration time is three days. This option is only valid when expire_backup_delete is enabled.
Save the configuration and exit.

3. Run mysql. backup at any time to perform the backup operation.

4. Automatic Backup
You can use the Linux crontab timing function to complete automatic backup.
In Linux, type crontab-e
Enter 30 02 ***/usr/local/sbin/mysql. backup to save and exit.

You can automatically back up all databases at 02:30 every day.

Script download:

Free in http://linux.bkjia.com/

The username and password are both www.bkjia.com

Download the MySQL automatic backup tool in the/pub/2011/10/31/Linux directory-Version 2/

Shows the backup effect:

  • 1
  • 2
  • Next Page

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.