mysql backup shell script

Alibabacloud.com offers a wide variety of articles about mysql backup shell script, easily find your mysql backup shell script information here online.

MySQL Sub-database sub-table backup script

after the mysqldump commandmydump= "Mysqldump-u$myuser-p$mypass-s $SOCKET-x-f-r --events"Workaround 2: in mysqldump command, Font-family:verdana, Arial, Helvetica, Sans-serif; " add --events--ignore-table=mysql.events parameter mydump= "Mysqldump-u$myuser-p$mypass-s $SOCKET-x-f-r - -events--ignore-table=mysql.events "Error Reference Solution:http://www.linuxbrigade.com/warning-skipping-data-table-mysql-event/http://bugs.mysql.com/bug.php?id=

Linux MySQL automatic backup delete script

Tags: User name linux database MySQL Local Create a backup directory/bak/mysqlbak Writing Run scripts vim/home/bakmysql.shCode:#!/bin/bashBackupdir=/bak/mysqlbakTime= "$ (date +"%y%m%d%h%m ")"/usr/local/mysql/bin/mysqldump-u xxxx (user name)-pxxxx (password) XXXX (database name) | gzip > $backupdir/xxxx (Custom ID) $time. sql.gzFind $backupdir-n

MySQL backup script

#!/bin/bash#auto backup MySQL#xiaosu 2015-08-06User=rootpassword=123456dir_back=/data/' Date +%y%m%d 'Date= ' Date +%y%m%d 'Database=test#判断用户是否是管理员rootIf [$UID-ne 0];thenEcho-e "\033[32mthe script must use root\033[0m"Sleep 2ExitFi#判断备份目录是否存在if [!-D $DIR _back];thenMkdir-p $DIR _back;ElseEcho-e "\033[32mthe $DIR _back is exist\033[32m"Fi#备份数据库/usr/local/

Automatically backs up MySQL Data and uploads it to the FTP shell script

Linux automatically backs up the MySQL database and uploads the shell script to the FTP server.#! /Bin/bash# Mysql autobackup shell### -------------- Set the mysql login parametersDbuser = rootDbpasswd =Dbserver = localhostDbname

MySQL backup script python written

(stderr) logging.info (' The database backup is complete ') def gettimepoint (days): " Returns the point in time that needs to be deleted ' Currtime = Time.time () DelTime = 3600*24*int (days) Timepoint = Currtime-deltime return T Imepoint def checkdir (cdir): "Delete folder function" ' Try:if os.path.isdir (cdir): Os.rmdir (Cdir) s = ' Remove dir%s succ ... '% cdir logging.info (s) except Exception as E:s = ' Remove D IR%s FAIL!!! %

Shell Learning automatic backup MySQL Database

backup, and the third is the executing program of the backup#Juge the exec user authorIf [$UID-ne 0];thenecho "must to is use the root for exec shell."ExitFi#以上的语句主要是用于判断是否用root用户执行#Juge If backup existsif [!-D $BAK _dir];thenMkdir-p $BAK _dirEcho-e "\033[32mthe $BAK _dir creat successfully!\033[0m"Elseecho "This $BAK

MySQL backup script

On the Internet to read a few scripts based on the Internet slightly modified under, slightly more prepared point, is missing something#!/bin/bash# Large Backup number backup_max_files=20# database backup directory working_dir=$ (dirname "$") Export working_dir=$ (cd-p "$WORKING _dir"/ >/dev/null; PWD) #数据库IP地址, account number, password db_host= "XXXXXXX" db_user= "XXXXXX" db_password= "XXXXXXX" #需要备份的数据库Da

MySQL backup script

Tags: mysql#!/bin/bash #Time: 2016-11-8 #owner: Fujinzhou #scriptname: mysqlback.sh #要备份的数据库名, multiple databases separated by spaces db= (Zabbix reboot10) #备份目录 backuppath= "/data/backup/" if [!-D "$BACKUPPATH"]; then mkdir-p "$Backuppath " fi #循环DB for DB in ${db[*]} do cd $BACKUPPATH #备份并打包数据库生成的sql文件 /bin/nice-n 19/usr/bin/mysqldump--defaults-file=/root/.my.cnf $db > ${db}_$ (Date +%y%m%d). SQL Tar zPc

Shell script to automatically restore MySQL database under Linux

Tags: sql elf usr UI roo backup source SQL database RACCreate the shell script Topjui_source.exp, which reads as follows:#!/usr/bin/expect Spawn echo "###### running ... ######" spawn echo $argv 0 Spawn echo $argv 1 set timeout Spawn mysql-uroot-p123456 set timeout expect { "hi" {send "you said hi\n"} "Hello" {send

A scheduled backup script on MySQL line

MySQL database remote backup data preferably packed and compressed[Email protected] crontab]# pwd/data/mysql_bakup/crontab[email protected] crontab]# cat backup_db_wangshibo.sh#!/bin/bashMysql= "/usr/bin/mysql"mysqldump= "/usr/bin/mysqldump"Backup_dir= "/data/mysql_bakup"#DB_SOCKET = "/var/lib/mysql/mysql.sock"Db_hostn

MySQL backup script

Touch mysql_backup.shchmod +x mysql_backup.shVim mysql_backup.sh#!/bin/bashId= "Root"Pwd= "123456"dbs= "Test Rockoa"Backuppath= "/root/mysqlbackup" backup path self-settingDay=15[!-D $backpath] mkdir-p $backuppathCD $backuppathbackupname=mysql_$ (Date +%y-%m-%d)for DB in $dbs;DoMysqldump-u$id-p$pwd-s/var/lib/mysql/mysql.sock $db > $backupname _$db.sqlIf ["$?" = = "0"]Thenecho $ (date +%y-%m-%d) "$db mysqldu

Python script to implement MySQL backup

#!/usr/bin/env python# Encoding:utf-8Import Os,time,sysBakup_dir = '/home/bak/mysql 'Current_time = Time.strftime ('%y%m%d%h%m%s ')user = ' root 'Password = ' root 'Database = [' MySQL ', ' aaa ']If Os.path.exists (bakup_dir):Print "The path%s exists"% Bakup_direlse:Os.makedirs (Bakup_dir)Print "The path%s create sucessful"% Bakup_dirOs.chdir (Bakup_dir)For I in range (len):A = Database[i]Mysqlbak_cmd = "my

Shell---mysql backup

#!/bin/bash#file:mysql_backup.sh#date2016-1-9backdes=/data/msyql_back/' date+%Y-%m-%d ' //Create the directory that holds the backup data backname= ' date+%y-%m-%d ' //backup name, You can omit the database=test//backed up database mysqluser=root// The user name at the time of backup #mysqlsec=//the password at the time of b

Enterprise-level development of MySQL startup script cases through shell scripting

Tags: shell mysql startup scriptEnterprise Shell face question 10: Develop MySQL startup scriptDescriptionThe MySQL startup command is:/bin/sh mysqld_safe--pid-file= $mysqld _pid_file_path 2>1 >/dev/null The Stop command is:Mysqld_pid= ' cat ' $mysqld _pid_file_path "'if (ki

Linux VPS Host scheduled automatic backup site and MySQL database script

after the execution of the script, our website and database are backed up into the/www/backup and then uploaded to the FTP space using the script lftp. Second, edit the backup script The code is as follows Copy Code

MySQL scheduled backup script

{} \;#-------------------------------------------------------------#crontabcrontab=$ (cat/var/spool/cron/root | grep mysqldatabase_bak_for_centos.sh | awk ' {print $8} ')if [$crontab = =./mysqldatabase_bak_for_centos.sh]; Thenecho "Crontab is ok!"Elseecho "1 1 * * * cd/opt/mysqldatabase_bak;bash./mysqldatabase_bak_for_centos.sh" >>/var/spool/cron/rootFi#-------------------------------------------------------------#movepwd=$ (PWD)if [$pwd = =/opt/mysqldatabase_bak]; Thenecho "The Scripts directo

Compile a shell script in CentOS to monitor MySQL master-slave replication,

Compile a shell script in CentOS to monitor MySQL master-slave replication, Objective: To regularly monitor whether the MySQL master-slave database is synchronized. If not, record the fault time and execute commands to restore the master-slave database to the synchronization state. 1. Create a

MySQL mysqldump Backup Script

###### script for backing up the database ################################# #author [email protected]################### user=backuppasswd= Managerhost=192.168.1.250date= ' Date +%y%m%d ' mysql_bin=/usr/local/mysql/bin$mysql_bin/mysqldump-u$user-p$passwd- H$host--single-transaction Test >/databackup/test/$date. sql if[-f/databackup/test/$date. SQL]thencd/databackup/test;tar-cvzf $date. sql.tar.gz $date. Sql

Shell script automatically fixes MySQL corrupted table _linux shell

"'" ' {print $} ' | Awk-f '/' {print $} ' if [-N ' $TABLES] then for i in '/usr/bin/awk '/' repair failed '/{print $} ' $LOG _path | sort-k1n | uniq-c | Awk-f "'" ' {print $} ' | Awk-f '/' {print $} ' do /data/soft/mysql/bin/mysql-u$db_user-p$db_pass $DB _name-e ' repair TABLE $i ' > Repair_$i if grep "OK" repair_$i >/dev/null then echo "$TIME repair TABLES $i successful!"

Binary installation of MySQL shell script

--basedir=/application/mysql/--datadir=/application/mysql/data/-- User=mysql >/dev/null[$?-eq 0] echo "init ok." | | Exit 1# # #cp MY-CNF[-F/ETC/MY.CNF] Mv/etc/my.cnf/etc/my.cnf.bakCp/application/mysql/support-files/my-innodb-heavy-4g.cnf/etc/my.cnf[$?-eq 0] echo "CP my.cnf OK." | | Exit 1# # #mysqlCp/application/

Total Pages: 15 1 .... 11 12 13 14 15 Go to: Go

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.