标签:directory span usr date pass mysql备份 .sql echo col
#!/bin/bash echo -e [`date +"%Y-%m-%d %H:%M:%S"`] start #system time time=`date +"%y-%m-%d"` #host IP host="127.0.0.1" #database backup user user="root" #database password passwd="yourpasswd" #Create a backup directory mkdir -p /backup/db/"$time" #list database name all_database=`/usr/bin/mysql -u$user -p$passwd -Bse ‘show databases‘` #in the table from the database backup for i in $all_database do /usr/bin/mysqldump -u$user -p$passwd $i > /backup/db/"$time"/"$i"_"$time".sql done echo -e [`date +"%Y-%m-%d %H:%M:%S"`] end exit 0
标签:directory span usr date pass mysql备份 .sql echo col
原文地址:https://www.cnblogs.com/Template/p/9229210.html