Skip to content

Instantly share code, notes, and snippets.

@ikbear
Created January 8, 2011 13:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ikbear/770856 to your computer and use it in GitHub Desktop.
Save ikbear/770856 to your computer and use it in GitHub Desktop.
简单的备份mysql数据库的脚本,完全自用,需要的可以参考一下,但绝不能照搬
#!/bin/sh
suffix=$(date +%y%m%d)
password="pass"
user="user"
mkdir db
cd db
mysqldump -u$user -p$password blog > blog.$suffix.sql
mysqldump -u$user -p$password en > en.$suffix.sql
cd ..
tar -cf db.$suffix.tar.gz db
rm -rf db
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment