12

I know this question was already asked before (like here), but still I could not find a solution and those posts are quite old.

So I am able to connect to the remote db with an ssh connection and then use the command line like this:

// Putty SSH Connection
host: ssh.strato.de
port: 22
username: xxxxxxx 
password: xxxxxxx 

// connect to mysql with terminal
mysql -h rdbms -u xxxxxxx -p xxxxxxxx

If I try the same with ssh-tunneling in DBeaver I get an connection error

enter image description here

The ssh-tunneling itself seems to work. If I use the same credentials as above and press "Test tunnel configuration" I get a success message.

enter image description here

I tried several other options for port and host (localhost, rdbms.strato.de, etc), which I found via mysql show variables; show processlist; show user();, but none of them worked.
The Strato Support told me that I can only connect to the db internally with phpmyadmin or remotely wiht putty and mysql, but since the last method is working, shouldn't ssh-tunneling also work?

link
  • 491
  • 1
  • 4
  • 13
  • I was having the same issue, with the same response from the server. I managed to get a functioning connection by creating a new one using the MariaDb driver instead of the MySQL one. – savedario Feb 13 '22 at 18:17
  • Du you also use Strato? Can you tell me your connection settings? I could not figure out how to set up the connection properly. – link Feb 13 '22 at 20:32
  • No, sorry. I used pretty much all the defaults from DBeaver. The only thing I changed was the host port for my setup and then choosing the driver did the trick. – savedario Feb 14 '22 at 21:27

2 Answers2

21

Dbeaver - Database connection using SSH Tunnel

  • Open dbeaver
  • Click on "New Database Connection", in the following "main" window enter the MySQL server host relative to the SSH server, and MySQL running port, my setting is default (localhost, 3306)
    specify MySQL user to connect with and user password. dbeaver main
  • In the "SSH" part, specify the SSH host, port, user also the authentication method used, like SSH private key dbeaver ssh Test connection and use.
Akshay Chandran
  • 985
  • 11
  • 16
  • 2
    This is also listed in the DBeaver docs: https://dbeaver.com/docs/wiki/SSH-Configuration/ - they explain Port Forwarding and Jump servers/Gateway server too. – icc97 Oct 07 '22 at 08:25
  • My notes from the problems I had: 1) I used the **Authentication Method: Agent** (I'm on linux). 2) I'm using AWS RDS and that requires setting the **Advanced > Remote host**. 3) Port forwarding via **Advanced > Local port** and **Advanced > Remote port**: in theory this should be automatic, but I found it useful to set them both to the expected database port (5432 for postgres) – icc97 Oct 07 '22 at 08:45
  • I have e xactly the same setup but still getting the error above – TheRealChx101 Dec 06 '22 at 10:11
  • 1
    You might need to change localhost to 127.0.0.1 in the main tab. – ivangretsky Dec 29 '22 at 17:52
0

On shared hosting setups (e.g. IONOS) there might be a restriction when trying to connect to MySQL from external client

https://www.ionos.com/help/hosting/troubleshooting-mysql-databases/connection-and-access-problems-with-mysql-databases/