I have set up a MySQL server and want to connect to it from different machines. However, I do not want to open it up to the public. To secure my connection, I will not allow external connections to the MySQL server. I will simply set up a SSH tunnel and connect to it that way. My local MySQL commands are forwarded to the remote host.
Assumptions:
- You can SSH into the remote host.
- If you are like me, you are not running a MySQL on your local host.
Setting up the SSH tunnel:
- ssh -f -L 3306:localhost:3306 user@host -N
- Enter password:
Connect to MySQL
- mysql -h 127.0.0.1 -u user -p
- Enter password:
You should be see the MySQL prompt.
mysql>
No comments:
Post a Comment