mysql备份bat备份脚本

 
@echo   off
set   errorlevel = 0
set  path_home_mysql = " I:JAVAMySQLMySQL Server 5.0"
set path_bin_mysql=%path_home_mysql%bin

set opt_mysql=--add-drop-database --add-drop-table 
set database_mysql=--databases active_rbac

set user_mysql=root
set password_mysql=root

set backup_dir=%path_home_mysql%db_backup
set backup_file=%backup_dir%mysql_backup_%date:~0,10%.tgz

dir %backup_dir% || echo make dir &mkdir %backup_dir%

IF EXIST %backup_file% ( del %backup_file% &echo %backup_file% is deleted)

echo backup mysql database:%database_mysql%
%path_bin_mysql%mysqldump -u%user_mysql% -p%password_mysql% %database_mysql% %opt_mysql% > %backup_file%

echo end backup

你可能感兴趣的:(mysql备份bat备份脚本)