>Description:
    mysql command line client seems to favor local sockets for 
    connections, even when -P or --port are used.

    I wish to have mysql connections tunneled through ssh.  This is
    complicated by the fact that I'm running mysqld on the remote host
    and the local host.  

    For those new to ssh tunneling, ssh can listen on a socket on the local
    host to forward connections through the ssh connection.  The remote
    host (involved in the ssh connection) will then connect to the redirect
    host.  The following command is used to forward a connections to port
    3307 on the local host to a remote host running mysql.  For simplicity,
    the database server and the ssh server are the same host.  They need not
    be.

        ssh -L3307:dbhost:3306 user@dbhost

    At this point a mysql client command like

        mysql -P 3307 -u user -p

    should connect to port 3307 on the local host.  If mysql is
    running, mysql will always connect using mysql.sock.

    If mysql is not running, the connection works as desired.

    I've found no work around, but using an alternate local socket
    comes to mind.  This would provide an inconvenience to the user
    as it would be necessary to always specify the socket on the mysql
    command line (is there another way to specify that is compatible with
    this?).  

    What would be nice is either of

    o -P or --port take preference over the local socket.  To avoid
      confusion if either port parameter is chosen, the socket should not
      be used at all (imagine dev, test, prod, and connecting to the 
      wrong db by accident).

    o Have an option on mysql to deactivate the use of the local socket
      (seems less elegant then above).

    BTW: Great product.  I love the package!

    Oh, this is output from the mysqlbug program.  I ran it on the mysql
    local host from this description.  My mail server is elsewhere, so
    I cut/pasted this into an email and sent to (what appeared to me to be)
    the correct address.

>How-To-Repeat:
    
    Unfortunately there is not a one line reproduction here, but it
    is rather simple:


    Prerequisites:

    mysqld running on localhost and on a remote host.  Remote host
    must run sshd, and user must have a local account.

    
    Reproduction

    From the local host

        ssh -L3307:remote.host:3306 [EMAIL PROTECTED]

    From the local host

        mysql --port=3307 -u dbuser -p


    In this case you'll either be connected to the local database (if the
    user and password are valid), or you'll be denied a connection.

    Shut down mysql locally

    Run the above mysql command again.

    You'll be connected to the mysql instance on the remote host.

    
    
>Fix:
    Unknown.  I'm proposing a change to the behavior of mysql.

>Submitter-Id:  
>Originator:    Andrew Libby ([EMAIL PROTECTED])
>Organization:  CommNav, Inc.
>MySQL support: none
>Synopsis: mysql command line client seems to favor local sockets over port 
>Severity:  non-critical
>Priority:  medium
>Category:  mysql
>Class:     sw-bug
>Release:   mysql-3.23.36 (Linux-Mandrake MySQL RPM)

>Environment:
    <machine, os, target, libraries (multiple lines)>
System: Linux mp3.dev.commnav.com 2.4.3-20mdk #1 Sun Apr 15 23:03:10 CEST 2001 i686 
unknown
Architecture: i686

Some paths:  /usr/bin/perl /usr/bin/make /usr/bin/gmake /usr/bin/gcc /usr/bin/cc
GCC: Reading specs from /usr/lib/gcc-lib/i586-mandrake-linux/2.96/specs
gcc version 2.96 20000731 (Linux-Mandrake 8.0 2.96-0.48mdk)
Compilation info: CC='gcc'  CFLAGS='-O3 -fomit-frame-pointer -pipe -mcpu=pentiumpro 
-march=i586 -ffast-math -fno-omit-frame-pointer'  CXX='g++'  CXXFLAGS='-O3 
-fomit-frame-pointer -pipe -mcpu=pentiumpro -march=i586 -ffast-math 
-fno-omit-frame-pointer'  LDFLAGS=''
LIBC: 
lrwxrwxrwx    1 root     root           13 Aug 17  2001 /lib/libc.so.6 -> libc-2.2.2.so
-rwxr-xr-x    1 root     root      1216268 Feb 21  2001 /lib/libc-2.2.2.so
-rw-r--r--    1 root     root     26366908 Feb 21  2001 /usr/lib/libc.a
-rw-r--r--    1 root     root          178 Feb 21  2001 /usr/lib/libc.so
Configure command: ./configure  --enable-shared --enable-thread-safe-client 
--enable-assembler --with-mysqld-user=mysql 
--with-unix-socket-path=/var/lib/mysql/mysql.sock --prefix=/ 
--with-extra-charsets=complex --exec-prefix=/usr --libexecdir=/usr/sbin 
--sysconfdir=/etc --datadir=/usr/share --localstatedir=/var/lib/mysql 
--infodir=/usr/share/info --includedir=/usr/include --mandir=/usr/share/man 
--with-berkeley-db --without-innobase '--with-comment=Linux-Mandrake MySQL RPM'


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to