ShellExecute using CMD to open mysql

1

Gentlemen, I would like to ask you if you have the command cmd to run mysql.exe on it, let me use a line of code:

ShellExecute(Handle,'open',PChar('cmd.exe'),PWideChar('/k cd\mysql\bin & mysql.exe --host 192.168.0.50 --user root --database=sinval --password= Repair Table item'), nil, SW_SHOW);

I want the last parameter path of ShellExecute () to execute a sql command, and I'd like it to look like this:

ShellExecute(Handle,'open',PChar('cmd.exe'),PWideChar('/k **Comando cmd & comando para entrar no mysql | comando sql**'), nil, SW_SHOW);

So, what do you think? Is there a better way to do this? If you do not understand, please speak, I'll try to see a better explanation.

    
asked by anonymous 22.05.2014 / 18:38

1 answer

4

You need to pass -e or --execute followed by the command you want to execute. For example:

mysql.exe --host 192.168.0.50 --user root --database=sinval --password=bla --execute "SELECT * FROM tbl"
    
22.05.2014 / 18:43