Why is connecting to MySQL server so slow?

后端 未结 4 888
無奈伤痛
無奈伤痛 2020-12-03 07:07

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 u

相关标签:
4条回答
  • 2020-12-03 07:34

    For me it was this solution I found here, If IP6 connectivity is enabled, connection to "localhost" may be slow, instead use the ip address, 127.0.0.1. This worked for me.

    my mysql slow to connect problem was solved by this solution

    0 讨论(0)
  • 2020-12-03 07:39

    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

    0 讨论(0)
  • 2020-12-03 07:43

    The --skip-name-resolve worked great for me.

    To make it permanent, I just add this line at the end of file my.ini in the [mysql] section:

    skip-name-resolve
    

    And voilá! Transactions now fly!

    0 讨论(0)
  • 2020-12-03 07:46

    firewalls, Internet, routing etc etc slows down your connection.

    You should put your database on a intra net instead. Keep it local and behind your big firewall. You can of course have firewall and security between computers. I'd recommend that you didn't expose your mysql database connection to the Internet unfiltered that way.

    0 讨论(0)
提交回复
热议问题