[英]Invoking mysqldump from script without password prompt
I need to execute a cmd command in Visual Basic. 我需要在Visual Basic中执行cmd命令。 It's not difficult but i need to give a argument while the external Programm runs.
这并不难,但我需要在外部程序运行时给出一个参数。
F:\mysql-5.7.13-winx64\bin\mysqldump.exe -h <ip> -u <user> -p <database> > abcd.sql
But after that is executed, the programm will ask for a password. 但在执行之后,程序将要求输入密码。 So how can i do that?
那我该怎么做呢?
Greetings, Dominic 问候,多米尼克
You can provide a password at command line (not secure): 您可以在命令行提供密码(不安全):
mysqldump.exe -h <ip> -u <user> --password="my_password" <database> > abcd.sql
You can also use Mysql options file . 您也可以使用Mysql选项文件 。 Create
my.cnf
with credentials details: 使用凭据详细信息创建
my.cnf
:
[mysqldump]
host="my_host"
user="my_user"
password="my_password"
And provide it to mysqldump 并将其提供给mysqldump
mysqldump.exe <database> --defaults-extra-file=my.cnf > abcd.sql
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.