Menu

#22 Unable to connect to ssh-mapped localhost port

open
nobody
Connections (7)
5
2004-12-07
2004-12-07
No

Hi,

I am very impressed with CocoaMySql. It is very elegant, and
works well.

I have run into one problem. I use ssh to connect to one of my
mysql servers, using a localhost port mapped to the mysql port
inside the client, and it appears that CocoaMySql does not like this.

For example, if I have connected via SSH with a command like:
ssh -l sellswor -c blowfish -g -L13306:sekmet3.company.com:3306
sshhost.company.com

The following command line does connect to the server:

work@phantom:work$ mysql --user=root --
password=whatevermyrootpasswordis --host=localhost --
port=13306

producing

Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 55 to server version: 4.0.18-standard-
log

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> use mysql;
Reading table information for completion of table and column
names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> show tables;
+-----------------+
| Tables_in_mysql |
+-----------------+
| columns_priv |
| db |
| func |
| host |
| tables_priv |
| user |
+-----------------+
6 rows in set (0.00 sec)

mysql> exit
Bye

but the same from cocoamysql does not:

<dict>
<key>database</key>
<string></string>
<key>host</key>
<string>localhost</string>
<key>name</key>
<string>root@sekmet3ssh</string>
<key>port</key>
<string>13306</string>
<key>socket</key>
<string></string>
<key>user</key>
<string>root</string>
</dict>

Could it be that the localhost address is making it ignore the port?

I have also tried 127.0.0.1 as the address, and it did not seem to
make a difference.

(NB: the company names, account names, and passwords are all
faked, but the terminal output was copied from my terminal
window.)

Discussion

  • Scott Ellsworth

    Scott Ellsworth - 2004-12-07

    Logged In: YES
    user_id=331345

    I posted the wrong db trancript above - I am actually connecting to
    3.23.53.

    Sekmet4:~ admin$ mysql --user=xxx --password=xxx --
    host=sekmet3.company.com
    Welcome to the MySQL monitor. Commands end with ; or \g.
    Your MySQL connection id is 5453 to server version: 3.23.53

    Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

    with the connection:
    <key>database</key>
    <string></string>
    <key>host</key>
    <string>127.0.0.1</string>
    <key>name</key>
    <string>root@sekmet3ssh</string>
    <key>port</key>
    <string>13306</string>
    <key>socket</key>
    <string></string>
    <key>user</key>
    <string>xxx</string>

    In summary, I can connect via the command line client to this 3.23.53
    database, but not via CocoaMySql when I am connected over an ssh link,
    whether I have the host be localhost or 127.0.0.1.

    It does make a difference to the command line client whether I use
    localhost or 127.0.0.1 - the command line will only notice the port and
    tunnel the traffic over IP if I use the dotted quad address.

    Scott

     
  • Nobody/Anonymous

    Logged In: NO

    It should work with 127.0.0.1 as port. I have tested it myself and heard
    from many user that it works like this. If you specify localhost as host,
    the port is ignored.

     
  • Rob Speed

    Rob Speed - 2004-12-14

    Logged In: YES
    user_id=983163

    What version of MySQL is running on the remote server?

    SSH tunneling works exactly as expected for me.

     
  • Scott Ellsworth

    Scott Ellsworth - 2004-12-14

    Logged In: YES
    user_id=331345

    Connection failures to 127.0.0.1 are occurring when I connect to a MySql
    server running version 3.23.53. The command line client can connect
    under these circumstances with the same username and password.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.