Home > Database > Mysql Tutorial > mysql远程备份并解决编码问题脚本_MySQL

mysql远程备份并解决编码问题脚本_MySQL

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-01 13:45:44
Original
1043 people have browsed it

bitsCN.com

#!/bin/bash
IP=192.168.0.198
mysqlpath=/usr/local/mysql/bin
variables=`$mysqlpath/mysql -u root -pmima  -h$IP  -e" show variables like 'character/_set/_%';" |awk '{print$2}' |sed -n '4'p`
$mysqlpath/mysqldump -uroot -pmima -h$IP   --default-character-set=$variables  keyword_ad>/back/mysqldb/s198db/keyword_ad_$(date +%Y%m%d).sql;
$mysqlpath/mysqldump -uroot -pmima -h$IP   --default-character-set=$variables  mysql>/back/mysqldb/s198db/s198mysql_$(date +%Y%m%d).sql;
sleep 180s
cd /back/mysqldb/s198db/
/bin/tar zcf keyword_ad_$(date +%Y%m%d).tar.gz keyword_ad_$(date +%Y%m%d).sql
/bin/tar zcf s198mysql_$(date +%Y%m%d).tar.gz s198mysql_$(date +%Y%m%d).sql
sleep 60s
/usr/bin/find /back/mysqldb/s198db/ -name "*.tar.gz"  -mtime +5 -exec rm -rf {} /;
sleep 60s
/usr/bin/find /back/mysqldb/s198db/ -name "*.sql"  -mtime +1 -exec rm -rf {} /;
 
本文出自 “学习要永恒” 博客

bitsCN.com
Related labels:
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
MySQL stops process
From 1970-01-01 08:00:00
0
0
0
Error when installing mysql on linux
From 1970-01-01 08:00:00
0
0
0
phpstudy cannot start mysql?
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template