Alibabacloud.com offers a wide variety of articles about mysql backup shell script, easily find your mysql backup shell script information here online.
Daily backup MySQL database tasks, delete the specified number of days before the data, keep the date of the specified day;
Demand:1, backup MySQL data 4 points per day;2, to save space, delete more than 3 months of all backup data;3, delete more than 7 days of
This article describes how to read and write a MySQL database in a shell. This paper mainly introduces how to connect the MySQL database in the shell, how to create the database in the shell, create the table, insert the CSV file, read the
Use mysqldump to back up MySQL data at a fixed time of day.
#!/bin/bash#每天早上4点, MySQL backup data orangleliu#chmod backup.sh#crontab-E#0 4 * * */home/erya/run/moniter/mysql_backup.shUser="radius"password=""host="localhost"Db_name="radius"#backup DirectoryBase_dir="/home/backup
Tags: mysql record databases#!/bin/bash#记录备份的时间echo "-----" $ (date + "%y-%m-%d%h:%m:%s") "-----" >>/data/backup_mysql/record.log#定义变量Myuser=rootmypassword=29749716# @HeiniaoSocket=/data/mysql/mysql.sockmycmd= "Mysql-u $MYUSER-p$mypassword-s $SOCKET"mydump= "Mysqldump-u $MYUSER-p$mypassword-s $SOCKET"Backupdir=/data/backup_mysql#正式备份For DB in ' $MYCMD-e ' show da
as follows:
*/10 * * * * root/bin/sh/root/mysql_slave.sh
Remember in each MySQL from the machine to allocate a Yuhongchun user, the permission is not OK, only limited to run locally, as follows:
Copy Code code as follows:
Grant all privileges on *.* to "Yuhongchun" @ "127.0.0.1" identified by "yuhongchun101";
Grant all privileges on *.* to "Yuhongchun" @ "localhost" identified by "yuhongchun101";
This article is mainly about how to use the shell to achieve a full amount of MySQL, incremental backup. Incremental backups are replicated mysql-bin.00000* to the specified directory at Monday-Saturday 3 o'clock in the morning, while full backups use mysqldump to export all of the databases, hold every Sunday 3 o'cloc
Back up mysql database bitsCN.com using shell scripts
Back up mysql databases using shell scripts
Requirement
Sort out some script programs near the end of the year and share with you a script for
There are many ways to back up a database. the most common method is automatic and scheduled Database Backup. next I will introduce how to use shell scripts in linux to back up a MySQL database regularly.
There are many ways to back up a database. the most common method is automatic and scheduled Database Backup. next
"——————————————-" >> $LogFile
Example 2. If you are dissatisfied with the above script, refer to the MySQL database backup script below.
The code is as follows
Copy Code
#!/bin/bash #Mysql autobackup
In the past, the company used a Shell script to automatically back up MySQL to FTP on the Internet, which has always been used well. But the problem is that as the number of backup files increases, it is inconvenient to regularly clean up the old backup files on FTP. In fact
#!/bin/bashcd= ' df-l |awk ' nr==3 {print $4} ' |awk ' BEGIN {fieldwidths= ' 2 1 "} ' {print '} 'If [$CD-ge 20];thenecho " hard disk space is full and cannot be backed up " | Mutt-s " backup alarm, please replace the hard drive in time " [Email protected] exit 1FiLogrotate-f/etc/logrotate.confTar zcf/opt/backup/' Date +%y%m%d%h%m '. tat.gz/var/log/messages.* >/dev/nullRt= ' echo $? 'If [$RT-eq 0];thenecho "
Mysql automatic backup script bitsCN.com in linux
Put the script in/home/user/mysql_backup.sh
Crontab
# Crontab-l
# M h dom mon dow command
28 16 ***/home/user/mysql_backup.sh
The script is as follows:
#! /Bin/sh
# Mysql_backup.sh: backu
Shell script: simple script for MySQL to start
It is recommended to compile a simple MySQL STARTUP script using shell scripts, and to practice the usage of variables, functions, and cas
Tags: script mysql incremental backup automatic pythonMySQL database is commonly used by the mysqldump export SQL for backup, but not suitable for a large number of databases, speed, lock table is two serious problems. The front has written a blog about Xtrabackup hot spare tools. The following
Tags: database mysql article backupThis article focuses on how to use the shell to achieve full MySQL, incremental backup. Incremental backups replicate mysql-bin.00000* to the specified directory in Monday-Saturday 3 o'clock in the morning, while full-scale backups use mysq
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.