Wherever the information is sent, it will appear to have originated from the server that you're currently connected to via SSH. By setting up an SSH tunnel, we can direct traffic to a specific port on our local machine, through our SSH connection to the server, and out to a destination server/port. The former can be particularly slow to work with while the latter can actually create security issues.
The usual solution to this conundrum is to either use the command line database tools from a terminal or to install something like phpMyAdmin so that you can access the database through a web browser. An unfortunate side effect of this security precaution is that is can significantly slow down development if every user that is working on a site has to be added to every database which they require access to, from every location they may be accessing it. As a security precaution, database users are setup with a so that even if somebody had your database username and password they'd have to be accessing it from the specified location in order to connect. The biggest difference with SSH tunneling is that all of the traffic is securely encrypted. By using tunneling one can (for example) carry a payload over an incompatible delivery-network, or provide a secure path through an untrusted network." Translation, you can connect to things on one machine as if you were on another, like a proxy. From Wikipedia "Computer networks use a tunneling protocol when one network protocol (the delivery protocol) encapsulates a different payload protocol.