php - Import MySQL Database on the XAMPP server using PHPscript -
i'm trying import rather large database local server (xampp) using following script.
<?php //enter relevant info below $mysqldatabasename ='****'; $mysqlusername ='****'; $mysqlpassword =*****'; $mysqlimportfilename ='05.03.2014.sql'; //do not edit below line $mysqlhostname ='localhost'; //export database , output status page $command='mysql -u' .$mysqlusername .' -s /tmp/mysql5.sock -p' .$mysqlpassword .' ' .$mysqldatabasename .' < ' .$mysqlimportfilename; exec($command,$output=array(),$worked); switch($worked){ case 0: echo 'import file <b>' .$mysqlimportfilename .'</b> imported database <b>' .$mysqldatabasename .'</b>'; break; case 1: echo 'there error during import. please make sure import file saved in same folder script , check values:<br/><br/><table><tr><td>mysql database name:</td><td><b>' .$mysqldatabasename .'</b></td></tr><tr><td>mysql user name:</td><td><b>' .$mysqlusername .'</b></td></tr><tr><td>mysql password:</td><td><b>notshown</b></td></tr><tr><td>mysql host name:</td><td><b>' .$mysqlhostname .'</b></td></tr><tr><td>mysql import filename:</td><td><b>' .$mysqlimportfilename .'</b></td></tr></table>'; break; } ?>
however, keep getting following error message "there error during import. please make sure import file saved in same folder script , check values"
i have feeling hostname might incorrect - i.e. /tmp/mysql5.sock
anybody able help?
cheers
a
you can use bigdump script import large database.
Comments
Post a Comment