Mysql remote database backup (only applicable to LAN)

Source: Internet
Author: User
#! Binbash # define database connection, target database information MY_USERuser # mysql user MY_PASSpass # mysql password MY_HOST192.168.1.1 # mysql database address MY_CONN-u $ MY_USER-p $ MY_PASS-h $ MY_HOSTMY_DB1db # database name # define Backup Directory, tool, time, file name subject BF_DIRtmp

#! /Bin/bash # define database connection and target database information MY_USER = "user" # mysql user MY_PASS = "pass" # mysql password MY_HOST = "192.168.1.1" # mysql database address MY_CONN =" -u $ MY_USER-p $ MY_PASS-h $ MY_HOST "MY_DB1 =" db "# database name # define the Backup Directory, tool, time, and file name subject BF_DIR ="/tmp

#! /Bin/bash # define database connection and target database information MY_USER = "user" # mysql user MY_PASS = "pass" # mysql password MY_HOST = "192.168.1.1" # mysql database address MY_CONN =" -u $ MY_USER-p $ MY_PASS-h $ MY_HOST "MY_DB1 =" db "# database name # define the Backup Directory, tool, time, and file name subject BF_DIR ="/tmp/dbbak/ "# Database Backup Directory BF_CMD ="/etc/mysql/bin/mysqldump "# mysqldump path BF_TIME = 'date + % Y % m % d-% H % m' NAME _ 1 = "$ MY_DB1-$ BF_TIME" # The pilot output is. SQL script, then compress $ BF_CMD $ MY_CONN -- databases $ MY_DB1> $ BF_DIR/$ NAME_1. SQL # export the SQL file cd $ BF_DIR/bin/tar zcf prepare $ NAME_1. SQL # compress the SQL File

Original article address: mysql remote database backup (only applicable to LAN). Thank you for sharing it with me.

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.