Automatic backup implementation using MySQLDUMP using the mysql database

zhaozj2021-02-16  104

Mysql database using mysqldump automatic backup Date: 2004/07/30 Author: zcatlinux Source: zclinux

With the MySQL database's mysqldump tool, you can implement the backup feature of the database. If you configure crontabs in the Linux system, you can implement automatic backup!

#! / bin / bash ## Configuring the original database connection information, that is, you need to back up the database machine. Source_user = -uroot ## If it is in this machine IP, Source_Host = -H127.0.0.1Source_host = -h10.10.12sSource_pass = -padministrator

## Configure the connection information of the backup database, that is, the database machine BAK_USER = -uroot ## for the backup of the database machine IPBAK_HOST = -h10.10.222Bak_pass = -padministrator

## From the original database, the content of the database table is exported, and generate SQL files, station is the database name, username and files for table name / var / mysql / bin / mysqldump --add-drop-table --Opt $ source_user $ Source_host $ source_pass station usrname> /TMP/Username.sql/var/mysql/bin/mysqldump --add-drop-table --Opt $ source_user $ source_host $ source_pass station files> /TMP/Files.sql

## Imported to backup Database / var / mysql / bin / mysql $ bak_user $ bak_host $ bak_pass station

转载请注明原文地址:https://www.9cbs.com/read-10666.html

New Post(0)