Timur Fayzrakhmanov Timur Fayzrakhmanov - 8 months ago 146
MySQL Question

Phpstorm. Can't access to mysql server through SSH tunnel (connection is closed by foreign host)

Sorry for the mistakes I've made, I'm not Englishman.

I use vagrant to deploy remote virtual machine as my web server which is configured to use

:private_network, ip: ""
. On the machine is installed Nginx, PHP, MariaDB etc.

Recently, I start to use phpstorm as my main IDE. Now I'm trying to configure access to remote database server, but I fail. Please, see the screens for additional information.

To check the ssh and mysql server access I tried the following:

$ ssh vagrant@ #ok
$ mysql -h localhost -P 3306 -u root -p #ok (it's run on the remote machine)
$ telnet -l root localhost 3306 #also run on the remote machine,
the output:
Connection closed by foreign host.

MariaDB configuration file seems to be ok. I only changed

I tried to set different configuration data, like: localhost:8080 instead of, double check password in SSH tunnel window, but nothing. Please, help me..

enter image description hereenter image description here


In my case I had to enable TCP forwarding in the ssh configuration of the remote host:

AllowTCPForwarding yes

And also I had to grant all privileges on users connection from (instead of just from 'locahost'):

grant all privileges on some_db.* to some_user@ identified by 'secret';