Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

sandersjj's avatar

Connecting to a my database on forge

Hello,

I have a digital ocean droplet on forge. Now I want to connect to the database on it's server from phpstorm. I made a connection via Database Sources and Drivers and when I press "Test Connection" i get the message that the connection was succesfull.

But when i try to do a query: "Select * From mydatabase.users" I get the following error in my console:

[2017-01-13 11:10:35] [08S01] Communications link failure
[2017-01-13 11:10:35] The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
[2017-01-13 11:10:35] java.net.ConnectException: Connection refused

Any suggestions?

Thanks

0 likes
6 replies
ejdelmonico's avatar

@dubbeltje I have never tried to connect via PhpStorm. I use the IDE daily but use Sequel Pro to connect to DB's. The forge server will only connect via ssh I think. So, try using the ssh option in PhpStorm.

nsandrew's avatar

In case anyone else finds this thread looking for the answer (like I did) I was able to get this to work in phpstorm 2018.2 connecting to mysql running on linode.

In the connection properties under the SSH/SSL tab:

  • enable Use SSH tunnel
  • Proxy host = the domain / IP of the instance running the DB
  • Port = 22
  • Proxy User = forge
  • Auth = Key pair [this assumes you have your SSH public key configured in forge]
  • Private key file = location of you .ppk
  • Passphrase = the ppk passphrase with remember password checked

In the general tab

  • Host = same domain / IP of the instance running the DB
  • Port = 3306
  • Database = your database name
  • User = forge

It might take a little experimenting.

6 likes
unicco33's avatar

@nsandrew It actually works! Testing the connection works but I'm still not receiving any schemes so the database seems to be empty - I dont understand that.

1 like
devjoenet's avatar

The settings that worked for me were nearly the same, but on in the general tab, don't put the host domain IP, put 127 . 0 . 0 . 1 instead. Since you are using a tunnel, you use the database like it were a local one.

Hope this helps!

1 like

Please or to participate in this conversation.