遠程連接MYSQL速度慢,有時遠程連接到MYSQL用時4-20秒不等本地連接顯示慢,本地連接MYSQL正常。
出現這種問題的主要原因是,默認安裝的 MYSQL開啟了DNS的反向解析。
解決方法:
在my.ini(系統下)或f(UNIX或LINUX系統下)文件的[]下加入 skip-name- 這一句。
連接mysql速度慢的解決方法。
附錄:( How MySQL uses DNS )
When a new to , will spawn a new to the . This will first check if the is in the cache. If not the will call () and () to the .
If the doesn’t the above -safe calls, the will lock a mutex and call () and () . Note that in this case no other can other that is not in the cache until the first is ready.
You can DNS host by with --skip-name-. In this case you can only use IP names in the MySQL .
If you have a very slow DNS and many hosts, you can get more by DNS with --skip-name- or by the (: 128) and .
You can the cache with --skip-host-cache. You can clear the cache with FLUSH HOSTS or flush-hosts.
If you don’t want to allow over TCP/IP, you can do this by with --skip-.
my.ini里面添加
[]
skip-name-
skip-grant-
這樣速度就快了!
skip-name-
選項就能禁用DNS解析,連接速度會快很多。 不過,這樣的話就不能在MySQL的授權表中使用主機名了而只能用ip格式。
若使用–skip-grant-系統將對任何用戶的訪問不做任何訪問控制,但可以用 flush-或 來開啟訪問控制; 默認情況是show 語句對所有用戶開放,
如果mysql服務器沒有開遠程帳戶本地連接顯示慢,就在my.ini里面加上skip-grant-
附,請根據情況開放
skip-name- 一般我們只要這一項便可以
skip-grant-