简体   繁体   English

mysqldump命令的windows批处理文件

[英]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. 这是我第一次制作Windows批处理文件。我希望不先做实验,因为它与实时服务器有关。 I use to back up mySql database by following open cmd write 我用跟随open cmd write来备份mySql数据库

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

then cmd ask password 然后cmd问密码

password = password

I want to make a windows batch file ,upon click I wish to perform the above functionality. 我想制作一个Windows批处理文件,点击后我希望执行上述功能。 Can any one please give some instructions related script of .bat file 任何人都可以给出一些与.bat文件相关的说明

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 请注意: -prootproot必须在一起

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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