为什么连接到MySQL服务器这么慢? [英] Why is connecting to MySQL server so slow?

查看:150
本文介绍了为什么连接到MySQL服务器这么慢?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用JDBC连接到MySQL.当它位于localhost:3306时,一切正常.

I use JDBC to connect to MySQL. When it’s at localhost:3306, everything is OK.

但是,当我将应用程序移动到Intranet中的另一台计算机上并使用<Intranet-IP>:3306连接到MySQL数据库时,大约需要1分钟才能成功连接到MySQL.这是怎么回事?

But when I move my application to another computer in the intranet, and use <Intranet-IP>:3306 to connect to the MySQL database, it takes about 1 minute to connect to MySQL successfully. What’s up with this?

推荐答案

这可能是DNS问题.您可以通过在配置文件中以--skip-name-resolve选项启动mysqld来禁用DNS主机名查找.

Well it could be a DNS problem. You can disable DNS host name lookups by starting mysqld with the --skip-name-resolve option in the configuration file.

在这里阅读更多详细信息: http://dev. mysql.com/doc/refman/5.0/en/host-cache.html

Read here for more details: http://dev.mysql.com/doc/refman/5.0/en/host-cache.html

这篇关于为什么连接到MySQL服务器这么慢?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆