I've been messing with this for the past two days and am still trying to figure it out...

As a part of a larger script, I have the following command that I'm trying to run in a php file:

```
$export = exec("/usr/bin/mysqldump -u MY_USERNAME -pMY_PASS DATABASE_NAME products > /path/to/www/directory/sync/products.sql");

```

This command doesn't work and if I add and echo `$result_var`, I get 127 instead of 0, so there's obviously some error. After some research, I've managed to come up with a slightly different command and it works just fine:

```
$export = exec('mysqldump -u MY_USERNAME -pMY_PASS DATABASE_NAME products -r "/path/to/www/directory/sync/products.sql"');

```

My **first question** - what's the difference? Why doesn't the first option work?
Maybe worth mentioning: using path on `mysqldump` makes no difference. I did a `which mysqldump` and the path in first command is correct.

My **second question** - I'm trying to run the following command to import a table into my database:

```
$import = exec('/usr/bin/mysql -h localhost -u MY_USERNAME -p MY_PASS DATABASE_NAME < /path/to/www/directory/sync/products.sql')

```

But it doesn't work, nothing happens. If I run it in command line, it just throws out the help text, as if I ran `mysql -?`

What am I missing here? Are there any other parameters (options) that I need to add to the mysql command? And, if so, what has changed? This code was running just fine on another server...