Split color platform to build sub-Library
Enterprise: 217 1793 408
[email protected] scripts]# cat backup_database.sh
#!/bin/bash
Mysql_user=root
mysql_pass=123456
Mkdir-p/backup
for n in mysql -u$mysql_user -p$mysql_pass -e ‘show databases;‘ 2>/dev/null|grep -Ev ‘_schema|mysql‘|sed ‘1d‘
;
Do
Mysqldump-u$mysql_user-p$mysqlpass-b $n 2>/dev/null>/backup/${n} date +%Y_%m_%d
. sql
Done
Sub-database sub-table
[email protected] scripts]# cat backup_tables.sh
#!/bin/bash
Mysql_user=root
mysql_pass=123456
Mkdir-p/backup
for n in mysql -u$mysql_user -p$mysql_pass -e ‘show databases;‘ 2>/dev/null|grep -Ev ‘_schema|mysql‘|sed ‘1d‘
;
Do
Mkdir-p/backup/$n
for M in mysql -u$mysql_user -p$mysql_pass $n -e "show tables;" 2>/dev/null|sed ‘1d‘
;
Do
Mysqldump-u$mysql_user-p$mysqlpass $n $m 2>/dev/null>/backup/${n}/${m} date +%Y_%m_%d
. sql
Done
Done
MySQL Sub-library backup split color platform to build backup data