My scenario looks as follows:
I have a web server and a DB server. On the webserver I have an SSH user with which I can connect to the database via mysql-client. The mysql port is restricted to the IP address of the webserver and I don't have an SSH user on the DB server.
I thought that some kind of SSH tunnel should be possible here, but I couldn't wrap my head around it yet.
I would have imagined something along these lines:
Tunnel: 127.0.0.1:9999 -> Webserver.IP:9999 -> DBserver.IP:3306
Mysql-Client CMD: mysql -u db_user -h 127.0.0.1 -p -P 9999
If anyone can share an idea on if and how this can be implemented I would be very grateful.