Skip to content

Instantly share code, notes, and snippets.

@iamajeesh
Last active December 27, 2015 16:59
Show Gist options
  • Save iamajeesh/7359111 to your computer and use it in GitHub Desktop.
Save iamajeesh/7359111 to your computer and use it in GitHub Desktop.
PHP Backup & restore The mysql DB
<?php
$host="localhost";
$dbname="";
$username="";
$passowrd="";
$location="";
$command="mysqldump -u".$username." -p".$passowrd." ".$dbname." > ".$location."";
system($command);
?>
<?php
$host="localhost";
$dbname="";
$username="";
$passowrd="";
$location="";
$command="mysql -u".$username." -p".$passowrd." ".$dbname." < ".$location."";
system($command);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment