您的位置:首页 > 数据库

MysSQL处理客户端连接与skip-name-resolve关系

2013-08-28 15:31 435 查看
一、连接过程:官方解释(http://dev.mysql.com/doc/refman/5.5/en/host-cache.html)For each new client connection, the server uses the client IP address to check whether the client host name is in the host cache. If not, the server attempts to resolve the host name. First, it resolves the IP address to a host name and resolves that host name back to an IP address. Then it compares the result to the original IP address to ensure that they are the same. The server stores information about the result of this operation in the host cache. If the cache is full, the least recently used entry is discarded
我的理解:
1.客户端 ip---à域名;域名--à ip ;比较第二步反解的ip 和客户端的源IP是否一致。
Mysql 处理客户端连接请求过程:
1.当mysql 客户端连接过来,服务器会找客户端的域名2.首先在服务器端 /etc/hosts 文件中找域名和ip 的对应关系(正解)3.若hosts 文件中没有,则在DNS 服务器中查找,若DNS中没有,则立即返回失败,此时设置了skip-name-resolve 就不会报错,但授权就不能采用主机名的方式,只能用ip授权。4.如果设置了DNS 服务器,且有记录,则再进行反解,比较反解后的IP和客户端的源IP是否一致。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息