mysql5.0 x 远程控制联接数据信息库慢的处理计划方案

mysql5.0 x 远程控制联接数据信息库慢的处理计划方案 发布時间: 来源于:不明 归类:SQL有关 创作者:岑溪网站建设 点一下:次
今应用mysql 开启远程控制数据信息库实际操作中发觉,每实行一个姿势,都必须等上几十秒或更久。

   一切正常状况 不能能要那么久,因此来到解了下MYSQL。总算搞清楚了,原先是mysql在远程控制联接时先选用网站域名分析去搜索服务器,当搜索不上时才会选用ip详细地址去找

   那样大家能够从这儿处理了。

  mysql 官方网 是那样说的:

 How MySQL uses DNS

  When a new thread connects to mysqld, mysqld will spawn a new thread to handle the request. This thread will first check if the hostname is in the hostname cache. If not the thread will call gethostbyaddr_r() and gethostbyname_r() to resolve the hostname.   If the operating system doesn t support the above thread-safe calls, the thread will lock a mutex and call gethostbyaddr() and gethostbyname() instead. Note that in this case no other thread can resolve other hostnames that is not in the hostname cache until the first thread is ready.   You can disable DNS host lookup by starting mysqld with skip-name-resolve. In this case you can however only use IP names in the MySQL privilege tables.   If you have a very slow DNS and many hosts, you can get more performance by either disabling DNS lookop with skip-name-resolve or by increasing the HOST_CACHE_SIZE define (default: 128) pile mysqld.   You can disable the hostname cache with skip-host-cache. You can clear the hostname cache with FLUSH HOSTS or mysqladmin flush-hosts.   If you don t want to allow connections over TCP/IP, you can do this by starting mysqld working.    
 从文本文档中大家能看到添加所述主要参数配备的缘故。mysql在远程控制联接时先选用网站域名分析去搜索服务器,当搜索不上时才会选用ip详细地址去找。 添加这一主要参数就严禁了mysql选用DNS分析的方法,而立即根据ip开展联接 自然依据文本文档中叙述,假如添加了 skip-name-resolve 配备得话,mysql也不能根据网站域名分析了。 假如应当把mysql数据信息库文件的user表格中的host字段名改为相对的ip。如 localhost 应当改成 127.0.0.1  
1、在mysql安裝文件目录下的my.ini(windows系统软件)配备文档中寻找[mysqld],在该行的下边加上以下配备  
在[mysqld]后边添加skip-name-resolve 后重新启动MYSQL 远程控制联接数据信息库慢处理了,谢谢 适用!

相关阅读