主頁 > 知識庫 > MySql使用skip-name-resolve解決外網鏈接客戶端過慢問題

MySql使用skip-name-resolve解決外網鏈接客戶端過慢問題

熱門標簽:地方門戶網站 AI電銷 百度競價排名 服務外包 Linux服務器 鐵路電話系統(tǒng) 網站排名優(yōu)化 呼叫中心市場需求

在騰訊云上面搭建的mysql使用開發(fā)的電腦上navicat進行訪問時總是特別的慢,原來是Mysql會對請求的地址進行域名解析,開發(fā)的電腦并沒有域名,所以會導致特別的慢,使用以下進行解決

[mysqld]
skip-name-resolve
skip-grant-tables

官方的解釋

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) and recompile 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 with
–skip-networking.

根據(jù)文檔說明,如果你的mysql主機查詢DNS很慢或是有很多客戶端主機時會導致連接很慢,由于我們的開發(fā)機器是不能夠連接外網的,所以DNS解析是不可能完成的,從而也就明白了為什么連接那么慢了。同時,請注意在增加該配置參數(shù)后,mysql的授權表中的host字段就不能夠使用域名而只能夠使用 ip地址了,因為這是禁止了域名解析的結果。

總結

以上所述是小編給大家介紹的MySql使用skip-name-resolve解決外網鏈接客戶端過慢問題,希望對大家有所幫助,如果大家有任何疑問請給我留言,小編會及時回復大家的。在此也非常感謝大家對腳本之家網站的支持!

您可能感興趣的文章:
  • IDEA鏈接MySQL報錯08001和連接成功后不顯示表的問題及解決方法
  • mysql安裝navicat之后,出現(xiàn)2059,Authentication plugin及本地鏈接虛擬機docker,遠程鏈接服務器
  • python pymysql鏈接數(shù)據(jù)庫查詢結果轉為Dataframe實例
  • MySQL多表查詢實例詳解【鏈接查詢、子查詢等】
  • 實例操作MySQL短鏈接
  • MySql 8.0.11 安裝過程及 Navicat 鏈接時遇到的問題小結
  • 詳解MySQL分組鏈接的使用技巧
  • 利用ssh tunnel鏈接mysql服務器的方法
  • MySQL 查看鏈接及殺掉異常鏈接的方法

標簽:仙桃 蘭州 湘潭 黃山 崇左 衡水 湖南 銅川

巨人網絡通訊聲明:本文標題《MySql使用skip-name-resolve解決外網鏈接客戶端過慢問題》,本文關鍵詞  ;如發(fā)現(xiàn)本文內容存在版權問題,煩請?zhí)峁┫嚓P信息告之我們,我們將及時溝通與處理。本站內容系統(tǒng)采集于網絡,涉及言論、版權與本站無關。
  • 相關文章
  • 收縮
    • 微信客服
    • 微信二維碼
    • 電話咨詢

    • 400-1100-266