MySQL有关1042 Can’t get hostname for your address的问题分析解决过程
[Comment 1]
前同事企鹅上面说他安装的mysql 5.5,发现用mysql客户端远程连接的时候,报1042-Can’t get hostname for your address错误,但是权限已经grant了并且grant成功了。
这个报错的意思是“您的地址无法获得主机名”,我就想到了skip-name-resolve参数。
官方文档:
-
Use IP addresses rather than host names when creating grant table entries. This option can be useful if your DNS does not work.
-
Do not resolve host names when checking client connections. Use only IP numbers. If you use this option, all
Hostcolumn values in the grant tables must be IP numbers orlocalhost. See Section 7.7.11, “How MySQL Uses DNS”.mysql> show variables like '%skip_name_resolve%';
+-------------------+-------+
| Variable_name | Value |
+-------------------+-------+
| skip_name_resolve | ON |
+-------------------+-------+
1 row in set (0.00 sec)mysql> set global skip_name_resolve=0;
ERROR 1238 (HY000): Variable 'skip_name_resolve' is a read only variable
mysql>
失败了,看来是只有修改my.cnf了在[mysqld]节点下修改
skip-name-resolve
#忽略主机名的方式访问
lower_case_table_names=1
#忽略数据库表名大小写重启MySQLD process即可。
[Comment 2]
前同事企鹅留言:
mysql -h 192.168.1.101 -u root -p
访问不了,我本地的mysql.192.168.1.101是本地ip地址。
grant all privileges on *.* to 'hive'@'192.168.1.101' identified by 'hive' with grant option;就是报连接不上,权限问题,怎么搞定。查看官方文档:
-
Variable Name hostnameVariable Scope Global Dynamic Variable No Permitted Values Type stringThe server sets this variable to the server host name at startup.
mysql> show variables like '%hostname%';
+---------------+-------------------------------------------+
| Variable_name | Value |
+---------------+-------------------------------------------+
| hostname | xxxxx.china.online.xx.com |
+---------------+-------------------------------------------+
1 row in set (0.00 sec) mysql> set global hostname='xxxxx2.china.online.xx.com';
ERROR 1238 (HY000): Variable 'hostname' is a read only variable
mysql>失败了,只有修改my.cnf了,在mysqld选项下面
[mysqld]
# 注释掉参数即可,mysql直接用本机ip不能访问
# hostname然后重启mysqld 服务即可。
MySQL有关1042 Can’t get hostname for your address的问题分析解决过程的更多相关文章
- mysql连接错误:Cannot get hostname for your address
问题 环境:win7 + 64Bit + 本地mysql5.6 问题:navicat连接本地mysql数据库,提示“Cannot get hostname for your address”,但是连接 ...
- mysql报错1024-can't get hostname for your address
前一段时间mysql用的好好的,突然一天,mysql启动后,在使用navicat连接数据库的时候 报错1024-can't get hostname for your address 这里我是这样解决 ...
- 【DataBase】mysql连接错误:Cannot get hostname for your address
问题 环境:win7 + 64Bit + 本地mysql5.6 问题:navicat连接本地mysql数据库,提示“Cannot get hostname for your address”,但是连接 ...
- 连接Mysql错误 error 1042 can't get hostname for your address
背景: 1.etc下的hosts文件有: 127.0.0.1 localhost 2.MySQL的my.ini配置文件: [mysqld] 节点下已经加入以下两行代码 skip-n ...
- #1042 - Can't get hostname for your address
my.ini 或 my.cnf 末尾添加 skip-name-resolve 并重启MySQL服务器 ok!
- MySQL : ERROR 1042 (HY000): Can't get hostname for your address
摘自: http://www.siutung.org/post/506/ 使用Navicat for MySQL连接远程的MySQL服务器,却提示:Can't get hostname for you ...
- MySQL数据库罕见的BUG——Can't get hostname for your address
在连接mysql jdbc时候,抛出了 com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Communicat ...
- 错误解决记录------------mysql连接本地数据库显示"can't get hostname for your address"
mysql连接本地数据库遇到 can't get hostname for your address 不明原因的本地mysql数据库连接不上,总是显示can't get hostname for yo ...
- mysql Communication link failure, message from server: "Can't get hostname for your address"
在连接mysql jdbc时候,抛出了 com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Communicat ...
随机推荐
- 装部署VMware vSphere 5.5文档 (6-2) 为IBM x3850 X5服务器安装配置VMware ESXi
部署VMware vSphere 5.5 实施文档 ########################################################################## ...
- BZOJ 2959: 长跑 lct 双联通分量 并查集 splay
http://www.lydsy.com/JudgeOnline/problem.php?id=2959 用两个并查集维护双联通分量的编号和合并. #include<iostream> # ...
- Lunix/Mac下根据最后修改时间复制文件和文件夹,保持原有的目录结构
度娘知道:http://zhidao.baidu.com/link?url=DD47jm6qDgT7yxsnz9e-NC4Fqd33oRoiIwcGLkw5TL4cbf50VKY2IONbHKH0IE ...
- Zookeeper的基本操作
写在前面的话:读书破万卷,编码如有神 -------------------------------------------------------------------- 参考内容: <私塾 ...
- ProtoBuffer使用笔记
ProtoBuffer是由谷歌研发的对象序列化和反序列化的开源工具,ProtoBuffer和Xml类似,都是数据描述工具,后者使用更为广泛,前者Google内部使用且具有更高的效率.该工具安装和使用都 ...
- JavaScript操作DOM(动态表格处理)
<html> <title>动态处理表格数据</title> <head> <script type="text/javascript& ...
- spring---aop(9)---Spring AOP中引入增强
写在前面 Spring将introduction通知看作一种特殊类型的拦截通知.用Spring的行话来讲,对方法的增强叫做Wearing(织入),而对类的增强叫introduction(引入).Int ...
- PWM DAC vs. Standalone
http://analogtalk.com/?p=534 http://analogtalk.com/?p=551 Posted by AnalogAdvocate on April 09, 2010 ...
- The sigrok project
http://www.sigrok.org/wiki/Main_Page The sigrok project aims at creating a portable, cross-platform, ...
- USB Mass Storage Class – Bulk Only Transport - Error Handling
6.4 Device Error Handling The device may not be able to fully satisfy the host's request. At the poi ...