国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 數(shù)據(jù)庫 > MySQL > 正文

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

2024-07-24 12:51:22
字體:
供稿:網(wǎng)友

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

[mysqld]skip-name-resolveskip-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ā)機器是不能夠連接外網(wǎng)的,所以DNS解析是不可能完成的,從而也就明白了為什么連接那么慢了。同時,請注意在增加該配置參數(shù)后,mysql的授權(quán)表中的host字段就不能夠使用域名而只能夠使用 ip地址了,因為這是禁止了域名解析的結(jié)果。

總結(jié)

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

您可能感興趣的文章:

完美解決mysql客戶端授權(quán)后連接失敗的問題解決MySQL客戶端輸出窗口顯示中文亂碼問題的辦法Windows下使用Cygwin編譯MySQL客戶端ThinkPHP結(jié)合ajax、Mysql實現(xiàn)的客戶端通信功能代碼示例MySQL 客戶端不輸入用戶名和密碼直接連接數(shù)據(jù)庫的2個方法mysql增加新用戶無法登陸解決方法MySql登陸密碼忘記及忘記密碼的解決方案mysql8.0.11客戶端無法登陸的解決方法
發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 昭平县| 登封市| 宁城县| 静乐县| 历史| 固安县| 汕头市| 通榆县| 济阳县| 三江| 青田县| 弋阳县| 东台市| 安溪县| 应用必备| 乐业县| 类乌齐县| 麻城市| 扬中市| 施秉县| 循化| 彰武县| 贵阳市| 海安县| 马龙县| 白山市| 九江县| 万源市| 武强县| 新乡市| 凭祥市| 开阳县| 黄冈市| 略阳县| 咸阳市| 正镶白旗| 兴国县| 萍乡市| 德保县| 昌吉市| 涟源市|