在.sql扩展中使用php代码导出数据库? [英] export database using php code in .sql Extension?
本文介绍了在.sql扩展中使用php代码导出数据库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否可以使用.sql扩展中的php代码导出数据库?
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
推荐答案
是可能.
<?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);
?>
这篇关于在.sql扩展中使用php代码导出数据库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文