Gökhan Kurt Gökhan Kurt - 1 year ago 76
MySQL Question

Mysql import command working when running on cmd but not when passing arguments directly

As I follow from the documentation, The import command in its most basic form is:

mysql.exe < example.sql

It works when I run it from the command line in Windows. But it doesn't work when I start the process
< example.sql
parameters. For example, creating a shortcut and setting its path to
mysql.exe < example.sql
doesn't work and it only prints the help info for

As a side note, I first noticed this problem when trying to run the following C# code:

new Process
StartInfo = new ProcessStartInfo
FileName = "mysql.exe",
Arguments = "< example.sql",

Answer Source

The part < example.sql does not contitute parameters for mysql.exe; the < character denotes a redirection operator, so the content of file example.sql is redirected into mysql.exe.

I guess you have to change the file name to cmd.exe and the arguments to /C "mysql.exe < example.sql". Consider to specify full absolute paths to all of the files.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download