job scheduling - Backup and Import automatically Mysql DB On Windows using task scheduler -


take backup of mysql database using batch command file

  1. create folder have permission
  2. 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

  3. create task windows task scheduler

  4. add event name "export"

  5. in action tab provide location of batch file e.g.

enter image description here

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. enter image description here 4.save , run task.


Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -