This can happen for a variety of reasons. Please troubleshoot the issue by following the steps below one by one.

1) Verify the address mysql is bound to, it’s probably 127.0.0.1 (only) which I believe is the default (at least on standard Ubuntu server). You’ll have to comment out the bind-address parameter in my.cnf to bind to all available addresses (you can’t choose multiple, it’s one or all).

2) If it is bound to 127.0.0.1 and you can’t connect using “localhost”, make sure it’s not resolving to the IPv6 localhost address instead of IPv4. (or just use the IP address)

3) Double and triple-check the port that mysql is listening on.

4) Make sure you’re using the right JDBC connector for your JDK.

5) Make sure you’re not doing something really silly like starting mysql with –skip-networking.

We have faced the issue with the JDBC connector. We have replaced the old JDBC connector with the latest one and everything worked fine.

Leave a Reply