简体   繁体   English

在没有密码提示的情况下从脚本调用mysqldump

[英]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.

相关问题 如何从批处理脚本调用管理员命令提示符而无需输入密码 - How to invoke administrator command prompt from batch script without having to enter password 使用密钥从 windows 中的 Tcl 调用命令提示符 - Invoking command prompt from Tcl in windows with key windows cmd/Powershell 如何在没有密码提示的情况下从私钥 pfx 文件中导出公钥? - windows cmd/Powershell how to export public key from private key pfx file without password prompt? 无法在不调用 perl.exe 的情况下在 cmd 中执行 perl 脚本 - Unable to execute perl script in cmd without invoking perl.exe 如何从控制台运行python脚本,就像从命令提示符下调用一样? - how to run python script from the console as if called from command prompt? 如何为从提示符调用的PowerShell脚本设置别名? - How do I alias a PowerShell script to be called from prompt? 我们如何从 Python 执行下面的命令提示符脚本 - How we can execute below Command Prompt Script from the Python 在远离我的计算机的远程计算机上运行bat脚本(命令提示符) - Run a bat script on a distant computer from my computer (Command Prompt) 从命令提示符运行 PowerShell 命令(无 ps1 脚本) - Run PowerShell command from command prompt (no ps1 script) 批处理脚本不会从命令提示符更改控制台代码页 - Batch script does not change console code page from command prompt
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM