I've got an hosting environment consisting of two separate servers: web-server and db server. The web-server is accessible via SSH only (and of course port 80). The DB server is inaccessible from the Internet and can only be accessed via the web-server.
The web-server doesn't have mysqldump and the space on the hard disk wouldn't allow to take a DB dump on the web-server.
I would like to use my local mysqldump and connect it via the web-server to the DB server. I'm not sure how to get the bash commands on order to work. I've tried this:
SSH Tunnel
ssh -f -L 3312:localhost:3306 user@web-server -i ~/.ssh/key-file -c cipher -N
mysqldump
mysqldump -P 3312 -h 127.0.0.1 -u user -p database > /tmp/db.sql
I'm aware that the db server needs to be included in the commands somehow, but I'm unsure how and where to include the IP of the DB server.