Rumah > Artikel > pangkalan data > MYSQL自动备份脚本
date_str=`date +%Y%m%d`cd /data2/backupmysqldump -h localhost -u oschina --password=xxxx -R -E -e \ --max_allowed_packet=1048576 --net_buffer_length=16384 mydb\ | gzip /data2/backup/mydb_$date_str.sql.gz
date_str=`date +%Y%m%d` cd /data2/backup mysqldump -h localhost -u oschina --password=xxxx -R -E -e \ --max_allowed_packet=1048576 --net_buffer_length=16384 mydb\ | gzip > /data2/backup/mydb_$date_str.sql.gz