在mysql中备份数据库最常用就是复制数据库了,下面我们一起来看两款windows 批处理实现的mysql备份方法,非常好用.
一,mysql中mysqldump+bat处理文件,执行mysql数据库备份的脚本(bat文件内容),代码如下:
- @echo off
- set host=localhost
- set username=root
- set passward=ansure
- set database=weihe
- set backup_path=D:\db_backup\
- echo "Mysql Backup , please waitting"
- mysqldump -h%host% -u%username% -p%passward% --skip-lock-tables %database% > %backup_path%\%database%_%date:~0,10%.sql
- echo "OK ! "
二,xcopy新建批处理文件backup.dat,里面输入以下代码:
- net stop mysql
- xcopy "C:\Program Files\MySQL\MySQL Server 5.0\data\piaoyi\*.*" D:\db_backup\%date:~0,10%\ /y
- net start mysql //Vevb.com
新闻热点
疑难解答