gpt4 book ai didi

php - 我从数据库 PHP 导出出了什么问题?

转载 作者:行者123 更新时间:2023-11-30 00:47:40 25 4
gpt4 key购买 nike

尝试使用此 PHP 从数据库导出,但它不起作用。

代码抛出以下错误消息:“将 dbname 导出到 ~/chooseFilenameForBackup.sql 时出现警告。”

感谢帮助。

<?php
//ENTER THE RELEVANT INFO BELOW
$mysqlDatabaseName ='dbname';
$mysqlUserName ='root';
$mysqlPassword ='password';
$mysqlHostName ='localhost';
$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,$output=array(),$worked);
switch($worked){
case 0:
echo 'Database <b>' .$mysqlDatabaseName .'</b> successfully exported to <b>~/' .$mysqlExportPath .'</b>';
break;
case 1:
echo 'There was a warning during the export of <b>' .$mysqlDatabaseName .'</b> to <b>~/' .$mysqlExportPath .'</b>';
break;
case 2:
echo 'There was an error during export. Please check your values:<br/><br/><table><tr><td>MySQL Database Name:</td><td><b>' .$mysqlDatabaseName .'</b></td></tr><tr><td>MySQL User Name:</td><td><b>' .$mysqlUserName .'</b></td></tr><tr><td>MySQL Password:</td><td><b>NOTSHOWN</b></td></tr><tr><td>MySQL Host Name:</td><td><b>' .$mysqlHostName .'</b></td></tr></table>';
break;
}
?>

最佳答案

您是否使用本地安装的 php,我遇到了同样的错误,直到我上传到我的服务器然后成功导出

关于php - 我从数据库 PHP 导出出了什么问题?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21224022/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com