为什么我会收到“不允许主机'192.168.1.220'连接到该MySQL服务器"的信息? [英] Why am I getting "Host '192.168.1.220' is not allowed to connect to this MySQL server"?

查看:507
本文介绍了为什么我会收到“不允许主机'192.168.1.220'连接到该MySQL服务器"的信息?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在LAN上运行MySQL(phpMyAdmin).这是我的连接字符串:

I need to run MySQL (phpMyAdmin) on a LAN. This is my connection string:

Function Connection() As MySqlConnection
    'Connect Database
    MyConnection.ConnectionString = "server=192.168.1.101;" _
 & "user id=root;" _
 & "password=;" _
 & "database=db1230018;"
    '
    MyConnection.Open()
    Return MyConnection
End Function

我得到一个错误:

不允许主机"192.168.1.220"连接到该MySQL服务器

Host '192.168.1.220' is not allowed to connect to this MySQL server

我有两台电脑.其中一个(Windows 7-192.168.1.101)使用上述连接字符串运行WAMP服务器(phpMyAdmin)和VB.NET应用程序.现在,我想使用192.168.1.101中的相同数据库在第二台PC(Windows)上运行该应用程序.我已经在两台PC上定义了一个固定IP并禁用了防火墙.发生了什么事?

I have two PCs. One of them (Windows 7 - 192.168.1.101) runs a WAMP server (phpMyAdmin) and a VB.NET application using the above connection string. Now I want to run the application on the second pc (Windows) using the same database in 192.168.1.101. I already define a fixed IP on both PCs and disable firewalls. What's going on?

推荐答案

可能您没有为root@192.168.1.220定义访问规则.然后服务器拒绝该连接.

Probably you have no access rule defined for root@192.168.1.220. Then the server refuses this connection.

此外,您还必须删除配置文件中有关绑定地址的限制.

Besides, you have to remove the restriction about the bind address in the config file.

此处,您将被告知如何可行:

Here you are told how that works:

GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'password' WITH GRANT OPTION;
FLUSH PRIVILEGES;

在MySQL中并删除行

in MySQL and remove the line

bind-address = 127.0.0.1

来自/etc/mysql/my.cnf.

当您从服务器收到上述消息时,可能不再需要后面的步骤.否则,您将从客户端收到一条消息,提示它无法连接到服务器.

As you get the said message from the server, it might be that the latter step isn't necessary any longer. Otherwise, you would get a message from the client that it is unable to connect to the server.

这篇关于为什么我会收到“不允许主机'192.168.1.220'连接到该MySQL服务器"的信息?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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