![]() | |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Hi All, Due to environment constraints, I have to be able to connect to the local mysql port (3306) via the hostname "localhost". However, using "localhost" makes mysql use sockets. This breaks because I don't have a local mysql server running, hence no socket. I can't seem to find any information about stopping mysql from using sockets when connecting via "localhost". Can this be done? I have inherited code that uses "localhost" to connect to a local mysql server in the production environment (in about 45 places). In the development environment, I have a mysql server on a Win2k machine. Because the code contains connection strings all over the place, I want to be able to leave the code as is in the development environment and use ssh to forward port 3306 on localhost to 3306 on Win2k mysql server. I can successfully do this if I use "127.0.0.1" but it seems the production environment only allows connections via "localhost" and this can not be changed. |
#3
| |||
| |||
|
|
Please reply to the post in comp.databases. |
#4
| |||
| |||
|
|
Stephan Carydakis wrote: Hi All, Due to environment constraints, I have to be able to connect to the local mysql port (3306) via the hostname "localhost". However, using "localhost" makes mysql use sockets. This breaks because I don't have a local mysql server running, hence no socket. I can't seem to find any information about stopping mysql from using sockets when connecting via "localhost". Can this be done? I have inherited code that uses "localhost" to connect to a local mysql server in the production environment (in about 45 places). In the development environment, I have a mysql server on a Win2k machine. Because the code contains connection strings all over the place, I want to be able to leave the code as is in the development environment and use ssh to forward port 3306 on localhost to 3306 on Win2k mysql server. I can successfully do this if I use "127.0.0.1" but it seems the production environment only allows connections via "localhost" and this can not be changed. |
#5
| |||
| |||
|
|
Stephan Carydakis wrote: Hi All, Due to environment constraints, I have to be able to connect to the local mysql port (3306) via the hostname "localhost". However, using "localhost" makes mysql use sockets. This breaks because I don't have a local mysql server running, hence no socket. I can't seem to find any information about stopping mysql from using sockets when connecting via "localhost". Can this be done? I have inherited code that uses "localhost" to connect to a local mysql server in the production environment (in about 45 places). In the development environment, I have a mysql server on a Win2k machine. Because the code contains connection strings all over the place, I want to be able to leave the code as is in the development environment and use ssh to forward port 3306 on localhost to 3306 on Win2k mysql server. I can successfully do this if I use "127.0.0.1" but it seems the production environment only allows connections via "localhost" and this can not be changed. I've used this technique and localhost has always worked fine, if it's defined in the hosts file as it should be. |
|
You are using 'ssh -L 3306:localhost:3306'? |
|
-- Lew |
#6
| |||
| |||
|
|
Yes. But the problem is not with SSH. Apparently, MySql automatically uses sockets on Linux when the client connects using "localhost". This takes port forwarding out of the equation. So how do I tell th MySql client to not uses sockets? |
#7
| |||
| |||
|
|
Stephan Carydakis wrote: Yes. But the problem is not with SSH. Apparently, MySql automatically uses sockets on Linux when the client connects using "localhost". This takes port forwarding out of the equation. So how do I tell th MySql client to not uses sockets? I am having trouble understanding what you just said. Port forwarding is all about sockets. The forwarded 3306 port is forwarded so that socket connections on the client machine become socket connections on the host machine. That is hardly "out of the equation". It /is/ the equation. |
|
-- Lew |
#8
| |||
| |||
|
|
"Lew" <l... (AT) nospam (DOT) lewscanon.com> wrote in message news:LKadnZ6hXNMREnTYnZ2dnUVZ_hzinZ2d (AT) comcast (DOT) com... Stephan Carydakis wrote: Yes. But the problem is not with SSH. Apparently, MySql automatically uses sockets on Linux when the client connects using "localhost". This takes port forwarding out of the equation. So how do I tell th MySql client to not uses sockets? I am having trouble understanding what you just said. Port forwarding is all about sockets. The forwarded 3306 port is forwarded so that socket connections on the client machine become socket connections on the host machine. That is hardly "out of the equation". It /is/ the equation. Unix sockets have no concept of ports. When using "localhost" to connect to a MySql server on Linux. it automatically uses sockets. |
|
You can not use sockets to connect to a remote server. You can only use sockets to connect to a local MySql server. See my predicament? -- Lew |
#9
| |||
| |||
|
|
Yes. But the problem is not with SSH. Apparently, MySql automatically uses sockets on Linux when the client connects using "localhost". This takes port forwarding out of the equation. So how do I tell th MySql client to not uses sockets? |
#10
| |||
| |||
|
|
"Lew" <lew (AT) nospam (DOT) lewscanon.com> wrote in message news:LKadnZ6hXNMREnTYnZ2dnUVZ_hzinZ2d (AT) comcast (DOT) com... Stephan Carydakis wrote: Yes. But the problem is not with SSH. Apparently, MySql automatically uses sockets on Linux when the client connects using "localhost". This takes port forwarding out of the equation. So how do I tell th MySql client to not uses sockets? I am having trouble understanding what you just said. Port forwarding is all about sockets. The forwarded 3306 port is forwarded so that socket connections on the client machine become socket connections on the host machine. That is hardly "out of the equation". It /is/ the equation. Unix sockets have no concept of ports. When using "localhost" to connect to a MySql server on Linux. it automatically uses sockets. You can not use sockets to connect to a remote server. You can only use sockets to connect to a local MySql server. See my predicament? |
![]() |
| Thread Tools | |
| Display Modes | |
| |