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

小編給大家分享一下怎么解決MySQL使用skip-name-resolve解決外網(wǎng)連接客戶端過慢的問題,希望大家閱讀完這篇文章后大所收獲,下面讓我們一起去探討吧!

創(chuàng)新互聯(lián)長期為成百上千客戶提供的網(wǎng)站建設(shè)服務(wù),團(tuán)隊(duì)從業(yè)經(jīng)驗(yàn)10年,關(guān)注不同地域、不同群體,并針對(duì)不同對(duì)象提供差異化的產(chǎn)品和服務(wù);打造開放共贏平臺(tái),與合作伙伴共同營造健康的互聯(lián)網(wǎng)生態(tài)環(huán)境。為安康企業(yè)提供專業(yè)的成都網(wǎng)站設(shè)計(jì)、做網(wǎng)站,安康網(wǎng)站改版等技術(shù)服務(wù)。擁有10余年豐富建站經(jīng)驗(yàn)和眾多成功案例,為您定制開發(fā)。

使用以下進(jìn)行解決

[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主機(jī)查詢DNS很慢或是有很多客戶端主機(jī)時(shí)會(huì)導(dǎo)致連接很慢,由于我們的開發(fā)機(jī)器是不能夠連接外網(wǎng)的,所以DNS解析是不可能完成的,從而也就明白了為什么連接那么慢了。同時(shí),請(qǐng)注意在增加該配置參數(shù)后,mysql的授權(quán)表中的host字段就不能夠使用域名而只能夠使用 ip地址了,因?yàn)檫@是禁止了域名解析的結(jié)果。

看完了這篇文章,相信你對(duì)怎么解決MySql使用skip-name-resolve解決外網(wǎng)連接客戶端過慢的問題有了一定的了解,想了解更多相關(guān)知識(shí),歡迎關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道,感謝各位的閱讀!

網(wǎng)站欄目:怎么解決MySql使用skip-name-resolve解決外網(wǎng)連接客戶端過慢的問題
標(biāo)題來源:http://www.muchs.cn/article30/jpjpso.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供定制開發(fā)外貿(mào)網(wǎng)站建設(shè)、關(guān)鍵詞優(yōu)化、動(dòng)態(tài)網(wǎng)站、網(wǎng)站設(shè)計(jì)公司網(wǎng)站設(shè)計(jì)

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場,如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)

網(wǎng)站優(yōu)化排名