This question already has an answer here:
Is it possible export database using php code in .sql Extension?
Example
database name : demodb
db contain two tables
table one : user
table two : registration
</div>
This question already has an answer here:
Is it possible export database using php code in .sql Extension?
Example
database name : demodb
db contain two tables
table one : user
table two : registration
</div>
Yes Its possible .
<?php
//ENTER THE RELEVANT INFO BELOW
$mysqlDatabaseName ='xxxxxx';
$mysqlUserName ='xxxxxxx';
$mysqlPassword ='myPassword';
$mysqlHostName ='xxxxxxxx.net';
$mysqlExportPath ='chooseFilenameForBackup.sql';
//DO NOT EDIT BELOW THIS LINE
//Export the database and output the status to the page
$command='mysqldump --opt -h' .$mysqlHostName .' -u' .$mysqlUserName .' -p' .$mysqlPassword .' ' .$mysqlDatabaseName .' > ~/' .$mysqlExportPath;
exec($command);
?>