"Host 'xxx' is not allowed to connect to this MySQL server":
来源:互联网 发布:理财软件下载 编辑:程序博客网 时间:2024/06/05 02:42
java.sql.SQLException: null,
表示该对象不是远程对象,不能通过该对象远程访问数据
解决:
方案一:改表:
use mysql ;select user,host,password from user;
update user set host = '%' where user='root';
方案二:授权法:
例如,你想myuser使用mypassword从任何主机连接到mysql服务器的话。
GRANT ALL PRIVILEGES ON *.* TO 'myuser'@'%' IDENTIFIED BY 'mypassword' WITH GRANT OPTION;
如果你想允许用户myuser从ip为192.168.1.3的主机连接到mysql服务器,并使用mypassword作为密码
GRANT ALL PRIVILEGES ON *.* TO 'myuser'@'192.168.1.3' IDENTIFIED BY 'mypassword' WITH GRANT OPTION;
MySql连接错误:Cannot get hostname for your address
简单解释
MySQL server received a request from you to allow you to connect to the database. So next thing it tried to do is to check what name is bound to your IP address (name resolution) andit failed to do so. So it just denied you access.
可以这么理解mysql处理客户端解析的过程:
1,当 mysql client 发起连接请求时,MySql Server 会主动去查 client 的主机名。
2,首先查找Windows系统目录下 /etc/hosts 文件,搜索域名和IP的对应关系。
3,如果hosts文件没有,则查找DNS设置,如果没有设置DNS服务器,会立刻返回失败;如果设置了DNS服务器,就进行反向解析,直到timeout
解决办法
第一种方法 修改Hosts
在 MySql Server 所在服务器上,修改 Windows 的 hosts 文件,增加一行记录,如:
100.ZZZ.YYY.XXX dummy.ju690.cn
然后在 100.ZZZ.YYY.XXX 机器上用 Python 发起连接请求,经测试,可以正常连接,说明 MySql Server 这下可以通过 getnameinfo() 解析出100.ZZZ.YYY.XXX 的主机名了。
但这种方法很机械,所以一般采用下面这种方法。
第二种 修改MySql 的配置文件 my.ini
The solution:
Just add skip-name-resolve option to your MySQL configuration file (my.ini).
在 MySql Server 的配置文件 My.ini 中,增加如下两行:
[mysqld]
skip-name-resolve
它将禁止 MySql Server 对外部连接进行 DNS 解析,使用这一选项可以消除 MySql 进行 DNS 解析的时间。
但需要注意,如果开启该选项,则所有远程主机连接授权都要使用IP地址方式,否则MySQL将无法正常处理连接请求。
- Host ''xxx.xx.xxx.xxx'' is not allowed to connect to this MySQL server
- host'xx.xxx.xxx.xxx' is not allowed to connect to this mysql server
- Host 'xx.xx.xxx.xxx' is not allowed to connect to this MySQL server
- MySQL:message from server: "Host xxx is not allowed to connect to this MySQL server"
- message from server: "Host 'xxx' is not allowed to connect to this MySQL server"
- message from server: "Host 'xxx' is not allowed to connect to this MySQL server的解决
- 解决MySQL ERROR 1130 (HY000): Host 'XXX' is not allowed to connect to this MySQL server
- Host 'XXX' is not allowed to connect to this MySQL server 解决方法/开启MySQL远程账号
- 【解决】Mysql关于Host \'XXX\' is not allowed to connect to this MySQL server 的问题
- 【MySql】---Host 'XXX' is not allowed to connect to this MySQL server
- MySQL said: Host 'XXX' is not allowed to connect to this MySQL server
- MySQL远程连接Host 'XXX' is not allowed to connect to this MySQL server 解决方案
- 【MySQL】1130- Host“XXX” is not allowed to connect to this MySql server
- mysql Host 'XXX' is not allowed to connect to this MySQL server 解决方案
- host is not allowed to connect to this MySQL server
- Host is not allowed to connect to this MySQL server
- host ... is not allowed to connect to this MySql server
- Host * is not allowed to connect to this MySQL server
- 题目1531:货币面值(网易游戏2013年校园招聘笔试题)
- 求一个整型数字中有没有相同的部分,例如12389756123这个整型数字中相同的部分是123,相同的部分至少应该是2位数,如果有相同部分返回1,如果没有则返回0。
- jquery清空select
- Android 获取签名、公钥方法
- 大草根平台列排行 成为电子商务首选
- "Host 'xxx' is not allowed to connect to this MySQL server":
- Linux内核----make ARCH=arm menuconfig时出错
- 开发android,我们需要哪些技能基础
- error: No resource identifier found for attribute 'onclick' in package 'android'
- struct 定义函数体 竟然可以!
- 一点一点重学统计学(一)——平均数与方差
- windows环境DLL链接问题之三:C/C++修饰符问题续
- 使用PDFlib生成pdf
- HDU 2054 A==B?,NYOJ-524-A-B(很有意思)