Friday, 15 May 2015

Restore mysql dump for specific table via PHP -



Restore mysql dump for specific table via PHP -

i've got mysql table dump file (which can viewed here: http://pastebin.com/raw.php?i=gqkjrdnz) utilize create table (named php_blog_archive per dump file) using contents of sql file.

the problem don't have access phpmyadmin, can execute via php command, i've looked @ few threads , code have far is,

<?php // config $db_user = "username"; $db_pass = "password"; exec("mysql -u $db_user -p $db_pass -h localhost databasename < restoreold.sql "); ?>

but doesn't work, nil - doesn't show errors. please advise me how proceed?

first of command must be:

<?php // config $db_user = "username"; $db_pass = "password"; exec("mysql -u " . $db_user . " -p " . $db_pass . " -h localhost databasename < restoreold.sql "); // added space before -h ?>

and second, you've right access create/edit/append file , exec command?

php mysql restore

No comments:

Post a Comment