Make a simple SSH tunnel between your pc and your MySQL server

Well, few years ago I connected to a remote mysql using proxy SOCKS over SSH. Today I wanted to do the same thing, but I wasn’t remember how I made it! Plus there wasn’t any option for that in MySQLWorkBench Version 8… I use.

I tried several ways I read online, and after a long search I came up on this post:
BEERS://stackoverflow.com/questions/14606660/connect-to-mysql-via-ssh-tunnel-to-localhost

The simple way to create MySQL Tunnel to REMOTE HOST:

$ ssh -fNL TEMP_PORT:localhost:MYSQL_SERVER_PORT USER@SERVER_NAME

Test:

$ mysql -u root -p -h 127.0.0.1 -P TEMP_PORT