phpMyAdmin-#1130-不允许主机"SERVER"连接到该MySQL服务器 [英] phpMyAdmin - #1130 - Host 'SERVER' is not allowed to connect to this MySQL server

查看:229
本文介绍了phpMyAdmin-#1130-不允许主机"SERVER"连接到该MySQL服务器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Windows server 2012 r2上运行WAMPServer,我想使用phpMyAdmin在其上运行数据库,一切正常,但是当我尝试从Windows服务器登录时,出现此错误:

是我看到的错误.

当我尝试从另一台计算机登录时,出现相同的错误.

有很多人遇到这个问题,所以我在Internet上进行了搜索,但我只能找到可以解决此问题的查询..但是我无法登录,因此无法对那些查询做任何事情.

我希望有人能为我解决这个问题,我将非常感激!

我在图片上遇到的两个错误:

#1130 - Host 'SERVER' is not allowed to connect to this MySQL server
mysqli_real_connect(): (HY000/1130): Host 'SERVER' is not allowed to connect to this MySQL server

解决方案

WAMPServer被配置为单个用户开发人员工具.因此,将安全性配置为保护初学者.

因此:

  1. 将phpMyAdmin别名配置为仅接受来自运行WAMPServer的PC的连接.
  2. 如同在MYSQL的任何sensibe默认配置中一样,root和任何其他 预先配置的MYSQL用户帐户也被配置为仅 可从运行MYSQL的PC上进行访问.

因此,要允许您从其他主机(PC)运行phpMyAdmin,您需要修改phpMyAdmin的Alias配置.

因此,请编辑\wamp\alias\phpmyadmin.conf( 注意 您的版本可能有所不同),然后修改Require设置,以允许从特定的或所有IP地址进行访问子网.

Alias /phpmyadmin "D:/wamp/apps/phpmyadmin4.7.0/"

<Directory "D:/wamp/apps/phpmyadmin4.7.0/">
    Options Indexes FollowSymLinks MultiViews
  AllowOverride all
  <ifDefine APACHE24>
        Require local

        ## Add access allowed from your subnet
        Require ip 192.168.1

    </ifDefine>
    <ifDefine !APACHE24>
        Order Deny,Allow
    Deny from all
    Allow from localhost ::1 127.0.0.1
    </ifDefine>

# To import big file you can increase values
  php_admin_value upload_max_filesize 128M
  php_admin_value post_max_size 128M
  php_admin_value max_execution_time 360
  php_admin_value max_input_time 360
</Directory>

现在您应该可以在另一台PC上运行phpMyAdmin

您现在必须在MYSQL中创建一个允许访问该用户需要从该用户访问的远程IP地址的数据库的用户.您应该转到服务器并使用phpMyAdmin,从那里以root身份登录,请记住root只能从运行MYSQL的PC上登录.

我建议您不要修改root的访问权限,而是创建一个新用户,并将该用户允许的任何访问权限授予该用户可以访问的哪个数据库.

例如

CREATE USER 'raul'@'192.168.1.%' IDENTIFIED BY 'mypass' PASSWORD EXPIRE NEVER;

将允许您从192.168.1子网中的任何IP地址登录. 根据您的实际情况进行修改.

然后允许该用户访问他将需要的数据库.

GRANT ALL ON test.* TO 'raul'@'localhost';

使用指向和点击phpMyAdmin

都可以做到这一点

I run WAMPServer on a Windows server 2012 r2, I want to run a database on it using phpMyAdmin, everything is working but when I try to login from the Windows server I get this error:

is the error that I see.

I get the same error when I try to login from a other computer.

There are allot of people having this problem so I searched all over the internet but all I can find are query's that can fix this problem.. But I can't login so I can't do anything with those query's.

I hope someone can fix this problem for me, I would really appreciate it!

The two errors I get on the picture:

#1130 - Host 'SERVER' is not allowed to connect to this MySQL server
mysqli_real_connect(): (HY000/1130): Host 'SERVER' is not allowed to connect to this MySQL server

解决方案

WAMPServer is configired to be a single user developer tool. Therefore the security is configured to protect the beginner.

Therefore:

  1. The phpMyAdmin alias is configured to only accept connections from the PC running WAMPServer.
  2. As in any sensibe default config of MYSQL the root and any other pre-configured MYSQL user accounts are also configured to only be accessible from the PC running MYSQL.

So to allow you to run phpMyAdmin from another host (PC) you need to amend the Alias configuration for phpMyAdmin.

So edit \wamp\alias\phpmyadmin.conf (NOTE your version may be different) and amend the Require setting to allow access from specific, or all the Ip Addresses in yor subnet.

Alias /phpmyadmin "D:/wamp/apps/phpmyadmin4.7.0/"

<Directory "D:/wamp/apps/phpmyadmin4.7.0/">
    Options Indexes FollowSymLinks MultiViews
  AllowOverride all
  <ifDefine APACHE24>
        Require local

        ## Add access allowed from your subnet
        Require ip 192.168.1

    </ifDefine>
    <ifDefine !APACHE24>
        Order Deny,Allow
    Deny from all
    Allow from localhost ::1 127.0.0.1
    </ifDefine>

# To import big file you can increase values
  php_admin_value upload_max_filesize 128M
  php_admin_value post_max_size 128M
  php_admin_value max_execution_time 360
  php_admin_value max_input_time 360
</Directory>

Now you should be able to run phpMyAdmin from another PC

You must now create a user within MYSQL that is allowed to access the database(s) that that user requires access to from whichever remote IP Addresses that user is allowed to access the database from. You should go to the Server and using phpMyAdmin, login as root from there, remember root can only login from the PC running MYSQL.

I suggest you do not amend the access rights of root but instead create a new user and give whatever access that user is allowed to which ever databases that user is allowed to access.

For example,

CREATE USER 'raul'@'192.168.1.%' IDENTIFIED BY 'mypass' PASSWORD EXPIRE NEVER;

Will allow you to login from any of the ip addresses in the 192.168.1 subnet. Amend this to fit your actual situation.

And then allow that user access to the databases he will require.

GRANT ALL ON test.* TO 'raul'@'localhost';

This is all possible using point and click via phpMyAdmin

这篇关于phpMyAdmin-#1130-不允许主机"SERVER"连接到该MySQL服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆