我有以下 php 代码:
<?php
$hostname="db.";
$database="db..";
$username="db...";
$password="pw...";
$mysql = mysql_connect($hostname, $username, $password);
if(!$mysql)
echo 'Not conneted to the database...' . mysql_error() ;
else
echo 'Connected to the database...' ;
// select the appropriate database
$mysqldb = mysql_select_db( $database );
if(!$mysqldb)
die('Could not select the database...' . mysql_error());
else
echo '<br /><br />Connected to database...<br /><br />' ;
$chk_table_access = 'select * from table_name where 1';
$chk_access = mysql_query($chk_table_access);
echo $chk_table_access . '<br /><br />';
if (!$chk_access)
echo 'Could not access table: ' . mysql_error() ;
else
echo 'Table was accessed..<br /><br />' ;
$backup = 'SELECT * INTO OUTFILE "result.csv" FIELDS TERMINATED BY "," OPTIONALLY ENCLOSED BY ';
$backup = $backup . "'" . '"' . "'" ;
$backup = $backup . ' FROM cities WHERE 1';
echo $backup . '<br /><br />';
$bk_success = mysql_query($backup);
if (!$bk_success)
echo 'The backup was not successful. Reason: ' . mysql_error();
?>
该程序在本地主机上运行良好,但是当我从我的网站运行它时,出现以下错误:用户'dbo????????'@'%'(使用密码:YES)的访问被拒绝。网络帮助没有多大帮助。
我确实收到“表已访问..”消息,所以我可以正常访问表。我每天都会对目录进行frwite,没有错误。我明白为什么它在 phpMyAdmin 中不起作用。我有点难过。这也是我在这个论坛上提出的第一个问题,虽然我经常来这里寻求帮助。你们(包括女士)摇滚。在此先感谢,史蒂夫