ssh firstname.lastname@example.org -p 4265 -L 13306:127.0.0.1:3306However, when I tried accessing port 13306 on my Ubuntu desktop, it failed:
$ mysql -u root -p -P 13306
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
It seems the default localhost server used by mysql client does a socket connection instead of TCP/IP. In order to overcome this, I had to use the --host option:
$ mysql -u root -p -P 13306 --host 127.0.0.1
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 115946
Server version: 5.1.49-3 (Debian)
Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL v2 license
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
That took me a while to figure out :)