Restore mysql database using php
I'm trying to restore MySQL dump created the following way:
require_once 'mysql_restore.class.php';
$restore_obj = new MySQL_Restore();
$restore_obj->server = 'localhost';
$restore_obj->usern开发者_C百科ame = 'root';
$restore_obj->password = '';
$restore_obj->database = 'database';
if (!$restore_obj->Execute(MSR_FILE, 'bk.sql.gz', true, false))
{
die($restore_obj->error);
}
but its showing an error
Warning: gzuncompress() [function.gzuncompress]: data error in C:\wamp\www\nidhin\mysql_restore.class.php on line 42 Warning: Invalid argument supplied for foreach() in C:\wamp\www\nidhin\mysql_restore.class.php on line 215
Any idea what I'm doing wrong?
function Execute($param, $mode = MSR_STRING, $is_compressed = false, $split_only = false)
You inverted the params order.
It's :
!$restore_obj->Execute('bk.sql.gz', MSR_FILE, true, false))
Instead of :
!$restore_obj->Execute(MSR_FILE, 'bk.sql.gz', true, false))
精彩评论