So if I was to set up an ssh tunnel for MySQL in terminal I would forward remote 3306 to local 3307:
ssh -L 3307:127.0.0.1:3306 firstname.lastname@example.org mysql -h 127.0.0.1 -P 3307 -u user -p db
When connecting in the same way using MySQL workbench there seems to be no option to specify the local port to forward to. So which one does it use? I'd like to be able to connect via tunnel to a remote database using MySQL workbench, and to also connect to it in the terminal via the workbench ssh connection, for which I'd need to know the local port workbench used.
Thinking it may use local 3306, I tried making a tunnelled connection in workbench and then the following in terminal, but it did not work:
mysql -h 127.0.0.1 -P 3306 -u user -p db