简体   繁体   中英

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 write

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

ECHO OFF
mysqldump -u user -p DBname >C:\DBname.sql
GO
SET password = password 
Go

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

以上仍然提示我输入密码,我使用下面的密码让它正常工作。

"C:\Program Files (x86)\MySQL\MySQL Server 5.5\bin\mysqldump.exe" -uroot -pDBPass DBName > C:\DBname.sql

The one-liner:

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

should do it.

You can use this:

"C:\Program Files\MySQL\MySQL Server 5.5\bin\mysqldump.exe" -u root -proot test > D:\DBname.sql

Please note this: -proot , the p and root must be together

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM