5

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

napuzba
  • 6,033
  • 3
  • 21
  • 32
Dominic Järmann
  • 361
  • 1
  • 7
  • 18

1 Answers1

6

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
napuzba
  • 6,033
  • 3
  • 21
  • 32