lots of ways to do it... one way I've done it when dealing with large sql files is open a pipe to mysqladmin and dump the SQL into it.
public function __construct()
$this->descriptorspec = array(
0 => array("pipe", "r"),
1 => array("pipe", "w"),
2 => array("file", "/tmp/error-output.txt", "a")
public function connect($command)
$this->process = proc_open($command,
public function send($message)
public function read()
$response .= fgets($this->pipes, 1024);
public function close()
public function __destruct()
/********** usage *****/
$process =& new Process;
$process->connect('mysqldump -u testuser -p --no-data testdb');
$response = $process->read();
this works... however the process class is "funny" as I cannot seem to read or wite to a proces after the initial read/writes. Still... works for the task at hand (you could replace the command with a mysql command... i.e. 'mysql -u user -p db < sqlfile.sql' and write your password to it. if you don't have pcntl, you can use popen (www.php.net/popen).
Also, in the most barebones of ways, you could read from the sql file line by line and pass it to mysql_query.