Home  >  Article  >  Database  >  MYSQL自动备份脚本

MYSQL自动备份脚本

WBOY
WBOYOriginal
2016-06-07 16:14:30896browse

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
Statement:
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