I have a simple script:
<?php
$dbhost = 'localhost';
$dbuser = 'root';
$dbpass = 'password';
$db = 'BPOJob';
$file =dirname(__FILE__).'\\'.'job_create.sql';
$mySQLDir='"C:\Program Files\MySQL\MySQL Server 5.1\bin\mysql.exe"';
$cmd = $mySQLDir.' -h '.$dbhost.' --user='.$dbuser.' --password='.$dbpass.' < "'.$file.'"';
exec($cmd,$out,$retval);
echo "\n";
echo ($retval);
?>
The thing is when I run the above command in PHP.exe, it doesn't work; I got a 1 as a return value from exec.
But if I run the command line directly by calling
mysql.exe -h localhost --user=admin --password=password < job_create.sql
Then the .sql file can run.
Is there anything I miss?
Edit: Sorry! Wrong info. I have edited the question and it's still valid.