mysqlperformanceintranet

Why is connecting to MySQL server so slow?


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

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?


Solution

  • 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.

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