Invoking mysqldump from script without password prompt
Asked Answered
I

1

6

I need to execute a cmd command in Visual Basic. 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

Idealist answered 27/7, 2016 at 17:45 Comment(1)
Can you post your method of calling this in Visual Basic?Larios
I
7

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. Create my.cnf with credentials details:

[mysqldump]
host="my_host"
user="my_user"
password="my_password"

And provide it to mysqldump

mysqldump.exe <database> --defaults-extra-file=my.cnf > abcd.sql
Interatomic answered 27/7, 2016 at 17:51 Comment(1)
Thank you:) This helped.Bite

© 2022 - 2024 — McMap. All rights reserved.