Remote database connection through vpn

Hi,
I'm trying to connect to a remote database with SSH,
I'm using openvpn to connect to the network of the target machine.

This worked when I was directly connected to that network,
but it doesn't with VPN.

My settings are:
Database URL:
  jdbc:mysql://localhost:3306

(jdbc connector, user and password are OK)

SSH settings are:
Use SSH tunnel:
  (checked)
SSH tunnel will be opened on localhost (127.0.0.1) and port:
  32443 (tried with several other high ports)
Proxy host:
  192.168.100.143 (this is the address of the target machine in the target network I'm connected to through openvpn)
Port:
  22 (default)
(proxy user and auth are OK)

(not 100% sure about these two, are they relative to the above proxy host?)
Remote DB host:
  localhost
Port:
  3306

PyCharm tries to connect to localhost,
if I insert the mysql credentials for my localhost mysql server it connects to it (even though "use SSH Tunnel" is checked).

Am i missing something?

P.S.
The target database is MariaDB, but i don't think that's the problem since I could connect when directly connected to that network...


SOLVED
the port in the Database URL must be the same as in SSH Tunnel port,
i.e.

jdbc:mysql://localhost:32443

Please sign in to leave a comment.