Wednesday, January 26, 2011

MySQL: Allow both remote AND local connections

In my Ubuntu's /etc/mysql/my.conf, I have:

bind-address = 192.168.2.20  # My external IP

It works fine from remote, but when I want to connect locally, the app that uses on MySQL says: java.net.ConnectException: Connection refused at com.mysql.jdbc.StandardSocketFactory.connect.

So when I want to work locally, I change my.cnf to:

bind-address = 0.0.0.0

And it starts working locally, but then it doesn't work from remote anymore.

How to make MySQL accesible both from remote AND local?

  • Just comment out bind-address= altogether. When you do that, it will bind to all addresses. Also make sure that you don't have skip-networking enabled in your my.cnf.

    Nicolas Raoul : Great, it works! Thanks a lot :-)
    ErikA : Awesome. Glad I could help!
    From ErikA

0 comments:

Post a Comment