Reputation: 6577
I'm trying to restore MySQL dump created the following way:
$file = '/path/to/file.sql';
exec('mysqldump -u '.DB_USER.' -p'.DB_PASS.' '.DB_NAME.' > '.$file);
the above creates the dump as expected, then to restore I'm trying to use the following:
$file = '/path/to/file.sql';
exec('mysql -u '.DB_USER.' -p'.DB_PASS.' '.DB_NAME.' < '.$file);
but for some reason it doesn't do anything.
Please note that the constants contain the relevant database connection parameters.
Any idea what I'm doing wrong?
Upvotes: 1
Views: 3748
Reputation: 35301
$file = realpath('file.sql');
exec('mysqldump -u ' . DB_USER . ' -p' . DB_PASS . ' ' . DB_NAME . ' > ' . $file);
Perhaps try this.
Upvotes: 0