我已经尝试了从我的本地主机到另一个服务器主机(也使用本地主机,因为我显然是在他们的服务器上使用of...going )的所有我能想到的ftp。我仍然在第6行收到这样的错误: Warning: mysqli::mysqli() mysqli.mysqli:(28000/1045):Access denied for user '(censored)_zxq'@'192.168.1.1‘(using password: YES) in /www/zxq.net/a/p/p/(censored)/htdocs/lib.php on line 6 Connect failed: Access censored for user '(censored)_zxq'@'192.168.1.1’(using password: YES)
我也尝试过支持mysql的多台主机……我一直收到这个错误,我知道我的凭据是正确的。并且我还将数据库的权限授予了用户。有什么建议吗?(ps。我审查了对我来说重要的信息)
<?php
$server = 'localhost';
$login = '792981_kputts';
$password = 'whatup4u';
$database = '(censored)_zxq_ireport';
//access
$connection = new mysqli($server, $login, $password, $database);
//executes a given sql query with the params and returns an array as result
function query() {
global $link;
$debug = false;
//get the sql query
$args = func_get_args();
$sql = array_shift($args);
//secure the input
for ($i=0;$i<count($args);$i++) {
$args[$i] = urldecode($args[$i]);
$args[$i] = mysqli_real_escape_string($link, $args[$i]);
}
//build the final query
$sql = vsprintf($sql, $args);
if ($debug) print $sql;
//execute and fetch the results
$result = mysqli_query($link, $sql);
if (mysqli_errno($link)==0 && $result) {
$rows = array();
if ($result!==true)
while ($d = mysqli_fetch_assoc($result)) {
array_push($rows,$d);
}
//return json
return array('result'=>$rows);
} else {
//error
return array('error'=>'Database error');
}
}
//loads up the source image, resizes it and saves with -thumb in the file name
function thumb($srcFile, $sideInPx) {
$image = imagecreatefromjpeg($srcFile);
$width = imagesx($image);
$height = imagesy($image);
$thumb = imagecreatetruecolor($sideInPx, $sideInPx);
imagecopyresized($thumb,$image,0,0,0,0,$sideInPx,$sideInPx,$width,$height);
imagejpeg($thumb, str_replace(".jpg","-thumb.jpg",$srcFile), 85);
imagedestroy($thumb);
imagedestroy($image);
}
?>发布于 2012-10-04 15:52:14
您的错误消息表明您没有从本地主机 (127.0.0.1)进行连接,而是进行了远程连接( *user '(censored)_zxq'@'192.168.1.1'* )
进行远程连接时,请确保:
通过将my.cnf中的绑定地址更改为远程用户连接有权连接的0.0.0.0
即使192.168.1.1是来自服务器的IP,它仍然被视为远程连接,必须执行步骤2和3(有时也是1)。
https://stackoverflow.com/questions/12722405
复制相似问题