job scheduling - Backup and Import automatically Mysql DB On Windows using task scheduler -
take backup of mysql database using batch command file
- create folder have permission
create batch file e.g.export.bat , copy/paste code export.bat
@echo off mysqldump.exe --user=root --host=localhost --password=mind --protocol=tcp --port=3306 --default-character-set=utf8 --single-transaction=true --routines --events --no-data "db_ows" > ows_back.sql
create task windows task scheduler
add event name "export"
in action tab provide location of batch file e.g.
6.now it's ready,check click on run created new file in same folder had created.
copy database
1.create batch @ same location "import.bat" , copy/paste code below file , same administration permission
@echo off mysql.exe --protocol=tcp --host={hostname} --user={username} --password={password} --port=3306 < "c:\\mysqlbkp\\{dbname}.sql" mysql.exe --protocol=tcp --host={username} --user=root --password={password} --port=3306 --default-character-set=utf8 --comments --database={dbname} < "c:\\{location of backup}\\backup_db.sql"
and save it.
2.create task task scheduler 3.in action tab keep following setting. 4.save , run task.
Comments
Post a Comment