0
votes

I have been trying to set up a new MySQL connection in PhpStorm (2016.1) for days now and cannot figure it out.

I am on a Mac OS X 10.11.4 and I have a Home Server (Ubuntu 14.04) and MySQL (5.5). I have a Firewall setup on the Server and have allowed all local connections to pass through (verified by connecting to MySQL on another computer).

I went into PhpStorm and added a new Database, entered the IP address (even tried host name) of remote (Home Server), and all credentials. When I hit "Test Connection" I get an error of

"Connection refused to host: localhost; nested exception is: java.net.ConnectException: Connection Refused"

I have "googled" about this error and one suggestion is to uncomment the localhost line in your hosts file (it was never commented out). I then though, maybe I need to have MySQL installed on my Mac, so I installed the current MySQL. Still get the same error. I even went under the SSH tab (PhpStorm) under the database setup and tried to set up a SSH Tunnel, still the same error.

Any suggestions?

PhpStorm Screen ShotSSH Tab From PhpStorm

1
I do not understand where localhost comes from. Please show SSH tab as well. - LazyOne
I added. I've tried it with and without SSH. - James W
Still no idea where localhost comes here from. You do not need any SSH if you can connect to that MySQL directly (e.g from another computer in the same network). So far it could be your 1) firewall 2) some antivirus/network security software 3) (unlikely) proxy settings in PhpStorm ... - LazyOne
I am confused also. I downloaded the Mysql Workbench to the same computer and can connect to the same Mysql ... - James W
Consider contacting support team then: intellij-support.jetbrains.com/hc/en-us/requests/new . I'm not a Mac user myself and cannot say where localhost is coming from. For me here on Windows 7 connecting to MySQL works just fine. But just to verify -- you have downloaded the MySQL drivers -- right? (from that screen) Because by default IDE comes with no actual JDBC drivers. - LazyOne

1 Answers

0
votes

(Posted on behalf of the OP).

After talking with JetBrains they were able to help me out. For some reason an address within my /etc/hosts file (on my Mac) was messing the connection up. Once I removed it, it connected. Somehow one of the IP addresses was making it loop back to localhost.