Is it possible to export the database with .sql Extension using PHP code?
Example
database name: demodb
DB contains two tables
table one: user
table two: registration
Is it possible to export the database with .sql Extension using PHP code?
database name: demodb
DB contains two tables
table one: user
table two: registration
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);
?>