i've never set up tunnels and such, but are you sure that your ssh tunnel is also listening on localhost (i.e. 127.0.0.1)? i once had a problem like that with my apache, and it turned out that it only listened on 'real' IPs....

cheers and good luck,

M.

[EMAIL PROTECTED] wrote:

Greetings,

This is a complicated one (at least to explain), but it never hurts to
ask, right?

While the problem lies mostly in PHP scripts, this also happens with the
standalone MySQL client (v4.0.15 I believe).

Normally the client (PHP and command-line) tries to use the local socket
if the mysql_connect() call asks for "localhost". This is normally a good
thing. Today wasn't normal :)

For reasons too complex for my tired brain to fully express right now, it
became desirable for me to use an SSH tunnel to forward connections to
port 3306 on localhost to a permanent database server on another rack
(same network).

If I used this syntax:

mysql -u root -p databasename --host=database.server.com --port=3306

It worked just fine; connects over the tunnel and works as if it were
localhost (some access restrictions popped up but those are easy to
manage).

Just asking for localhost, though, it complains that the socket isn't
available and croaks. The same goes for PHP scripts. They get the finger
from the library and it doesn't try over TCP/IP. Just gives up and dies.

There's a few hundred scripts (most of which I don't have control over)
that are using "localhost" and changing them to use "127.0.0.1" or
"database.server.com" isn't feasible without organizing a *lot* of people
to do the work.

I'm curious if it's possible to instruct the client library (I assume PHP
and the MySQL client both use the same underlying shared library) to
either fall back to using TCP/IP (turning localhost into 127.0.0.1, for
example) when the socket isn't there, or to tell it at the server level
that it should be using TCP/IP instead of sockets entirely.

It's either that or I get to start munging many many scripts. Any
suggestions how to do this? Platform is Linux (x86), client and server
both 4.0.15 or newer.

Thanks for any suggestions, even if they're just "get ready to start
editing lots of scripts" :)


-- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]



Reply via email to