Dump Database - Php

How to dump mysql database using php code?

Snippet Code

Rate this page :
  [ 0 votes]

Enter the following details as mentioned below and give the desired path in the export path variable. This php code can be used to dump mysql database.

<?php //Fill the below information $dbname ='ajaxvoting';//your dbname $username ='root';//your username $password ='';//your password $hostname ='localhost';//your hostname $exportpath ="mydb.sql";//your export path $command='/usr/local/bin/mysqldump -h ' .$hostname .' -u ' .$username .' ' .$dbname .' > ' .$exportpath; echo $command; exec($command); ?>


Ask Questions

Ask Question