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 ...
随机推荐
- python opencv3 FLANN单应性匹配
git:https://github.com/linyi0604/Computer-Vision 匹配准确率非常高. 单应性指的是图像在投影发生了 畸变后仍然能够有较高的检测和匹配准确率 # codi ...
- php开启memcache扩展
1.下载memcache.dll(php7)https://github.com/nono303/PHP7-memcahe-dll/tree/master 2.将dll文件放到php7/ext目录下 ...
- BZOJ.2286.[SDOI2011]消耗战(虚树 树形DP)
题目链接 BZOJ 洛谷P2495 树形DP,对于每棵子树要么逐个删除其中要删除的边,要么直接断连向父节点的边. 如果当前点需要删除,那么直接断不需要再管子树. 复杂度O(m*n). 对于两个要删除的 ...
- Codeforces Round #461 (Div. 2)
A - Cloning Toys /* 题目大意:给出两种机器,一种能将一种原件copy出额外一种原件和一个附件, 另一种可以把一种附件copy出额外两种附件,给你一个原件, 问能否恰好变出题目要求数 ...
- Dijkstra_Liu博客100篇祭
创建博客,有两年三个月了.今天,写了100篇随笔了,又正值我的15岁生日,还是值得纪念一下. 两年过去了,我从学习:队列.栈.模拟.背包慢慢地变成了:Tarjan.线段树.树剖. 我也从一个初一的天真 ...
- python配置文件操作——configparser模块
# -*- coding: utf-8 -*- ''' Version : Python27 Author : Spring God Date : 2012-4-26 Info : 配置文件ini所在 ...
- Codeforces Round #298 (Div. 2) A. Exam 构造
A. Exam Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/534/problem/A Des ...
- Codeforces Round #297 (Div. 2)A. Vitaliy and Pie 水题
Codeforces Round #297 (Div. 2)A. Vitaliy and Pie Time Limit: 2 Sec Memory Limit: 256 MBSubmit: xxx ...
- flash从数据流判断图片格式防止xss攻击
前段时间测试人员报了一个flash的xss bug,经分析用了Loader.loadBytes且没做数据流格式校验的程序都会中招,自测方法只需一行代码: ExternalInterface.call( ...
- SVN服务器与客户端下载地址_搭建使用
下载地址: http://subversion.apache.org/packages.html Windows CollabNet (supported and certified by Colla ...