Import Mysql Using PHP

define(DB_HOST, 'localhost');
define(DB_USER, 'root');
define(DB_PASSWORD, '');
define(DB_NAME, 'products');
$dir = dirname(__FILE__);
$sql = $dir . 'products.sql';
$command = "mysql --user=" . DB_USER." --password=".DB_PASSWORD . " --host=".DB_HOST." " .DB_NAME." < ".$sql;
echo $command;
system($command);

 

 

Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedInPrint this pageEmail this to someone

Leave a Reply

Your email address will not be published. Required fields are marked *