Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/243.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php MySQL在多台主机上重复拒绝_Php_Mysql_Localhost_Denial Of Service - Fatal编程技术网

Php MySQL在多台主机上重复拒绝

Php MySQL在多台主机上重复拒绝,php,mysql,localhost,denial-of-service,Php,Mysql,Localhost,Denial Of Service,我已经尝试了我能想到的一切…从我的本地主机转到另一台服务器主机(这台主机也使用本地主机,因为我显然在他们的服务器上使用ftp),但我仍然不断收到错误: 警告:mysqli::mysqli()[mysqli.mysqli]:(28000/1045):第6行的/www/zxq.net/a/p/p/(censtered)/htdocs/lib.php中的用户(已审查)访问被拒绝 连接失败:用户的访问被拒绝(已审查)_zxq'@'192.168.1.1'(使用密码:是) 我也尝试过多台支持mysql的主

我已经尝试了我能想到的一切…从我的本地主机转到另一台服务器主机(这台主机也使用本地主机,因为我显然在他们的服务器上使用ftp),但我仍然不断收到错误: 警告:mysqli::mysqli()[mysqli.mysqli]:(28000/1045):第6行的/www/zxq.net/a/p/p/(censtered)/htdocs/lib.php中的用户(已审查)访问被拒绝 连接失败:用户的访问被拒绝(已审查)_zxq'@'192.168.1.1'(使用密码:是)

我也尝试过多台支持mysql的主机……我不断地遇到这个错误,我知道我的凭据是正确的。我已经给了数据库和用户权限。有什么建议吗?(注:我审查了对我来说重要的信息)


您的错误消息表明您不是从本地主机连接(127.0.0.1),而是进行远程连接(*user'(已审查)_zxq'@'192.168.1.1'*)

进行远程连接时,请确保:

  • 所有防火墙(客户端和服务器)的端口3306都处于打开状态
  • 通过将my.cnf中的绑定地址更改为0.0.0.0,将mysql配置为远程连接
  • 远程用户连接具有连接权限

即使192.168.1.1是来自服务器的IP,它仍然被视为远程连接,并且必须执行步骤2和3(有时也是1)。

通过ftp将phpmyadmin安装到该服务器并尝试登录。如果它也失败,你的登录信息是不好的。我认为即使你说是也不好。请以root用户身份登录数据库,并发布“792981_kbutts”@“localhost”和“792981_kbutts”的
SHOW GRANTS
的输出,感谢您迄今为止的帮助。我做了“show grants”,它给了我一个长得离谱的密码:81F5E21E35407D884A6CD4A731AEBFB6AF209E1B。无论如何,这只给了我一个新的错误:警告:mysqli::mysqli()[function.mysqli mysqli]:(HY000/2002):无法通过/srv/disk11/1158855/www/(censtered)/lib.php第8行的套接字“/var/run/mysqld/mysqld.sock”(2)连接到本地MySQL服务器谢谢您的响应,但我的端口位于3306,防火墙已关闭。出于沮丧,我切换回了本地(如果三个不同的主机都说了同样的话,那就足够了),并且权限设置正确。我应该补充一点,我在这里使用的是MAMP。还有其他建议吗?现在是警告:mysqli::mysqli()[function.mysqli mysqli]:(HY000/2002):无法通过第8行的套接字“/var/run/mysqld/mysqld.sock”(2)连接到本地MySQL服务器MySQL正在运行吗<代码>ps aux | grep mysqld是的!我从来没有使用过命令行方法,是吗?我通常使用sequel pro(我可以通过该程序连接),如果我在我的计算机上使用MySQL,那么localhost可以工作吗?
<?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);
}

?>