Learnner Learnner - 3 months ago 41
MySQL Question

windows batch file for mysqldump command

this is first time I am upto making a windows batch file.I wish not to do experiments first as its related to live server.
I use to back up mySql database by following
open cmd

mysqldump -u user -p DBname >C:\DBname.sql

then cmd ask password

password = password

I want to make a windows batch file ,upon click I wish to perform the above functionality.
Can any one please give some instructions related script of .bat file

So far I wrote this

mysqldump -u user -p DBname >C:\DBname.sql
SET password = password

but still it prompts me for password .
I wish password get enter automatically


The one-liner:

mysqldump -u user -p DBname --password YOURPASSWORD > C:\DBname.sql

should do it.