Home > Archive > MySQL ODBC Connector > April 2006 > Is port forwarded connection taken as local?









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Is port forwarded connection taken as local?
Bing Du

2006-03-31, 8:25 pm

Hello everyone,

What I'm after is trying to figure out a way to centrally and remotely
managing (e.g. on server1) our MySQL servers (server2 is an example) on
different machines. Right now, these MySQL servers are all set up to onl=
y
accept logons from localhost. My questions:

1. server1 has to be able to connect to server2 directly via SSH, right?
2. On server2, does 'grant ...to someuser@server1 identified by ...' have
to be done?

I've been looking through the relevent threads regarding how to make port
forwarding for MySQL work. I saw one thread mentioned that port forwarde=
d
MySQL connection was taken as a local connection. But my own testing
cannot agree with that. I'm confused. Here is what I did:

On server1:

server1% ssh -2 -l myusername -N -L 3307:server2:3306 server2

server1% mysql -P 3307 (in another term window)

ERROR 1045 (28000): Access denied for user 'myusername'@'localh
ost' (usin=
g
password: YES)

But on server2, the following command works fine.

server2% mysql -h localhost -u myusername -p

I'd appreciate if anybody would shed some light.

Bing

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql? unsub...sie.nctu.edu.tw

gerald_clark

2006-03-31, 8:25 pm

Bing Du wrote:

>Hello everyone,
>
>What I'm after is trying to figure out a way to centrally and remotely
>managing (e.g. on server1) our MySQL servers (server2 is an example) on
>different machines. Right now, these MySQL servers are all set up to only
>accept logons from localhost. My questions:
>
>1. server1 has to be able to connect to server2 directly via SSH, right?
>2. On server2, does 'grant ...to someuser@server1 identified by ...' have
>to be done?
>
>I've been looking through the relevent threads regarding how to make port
>forwarding for MySQL work. I saw one thread mentioned that port forwarded
>MySQL connection was taken as a local connection. But my own testing
>cannot agree with that. I'm confused. Here is what I did:
>
>On server1:
>
>server1% ssh -2 -l myusername -N -L 3307:server2:3306 server2
>
>server1% mysql -P 3307 (in another term window)
>
>ERROR 1045 (28000): Access denied for user 'myusername'@'localh
ost' (using
>password: YES)
>
>

You need to grant permissions to 'myusername'@'localh
ost' as indicated
in the line above.

>But on server2, the following command works fine.
>
>server2% mysql -h localhost -u myusername -p
>
>I'd appreciate if anybody would shed some light.
>
>Bing
>
>
>



--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql? unsub...sie.nctu.edu.tw

Bing Du

2006-04-03, 9:29 am

> Bing Du wrote:
>
?[color=darkred]
ve[color=darkred]
rt[color=darkred]
> You need to grant permissions to 'myusername'@'localh
ost' as indicated
> in the line above.
>


Yes, I understand the error message. What confused me was if I connected
as 'myusername' directly on server2, there was not any problem at all as
what was shown in the following in my original post. So in another word,
'myusername'@'localh
ost' was denied access if connecting via port
forwarding, but it's allowed access if connecting from localhost. Hence m=
y
question, if port forwarded connections are really taken as local
connections???
[color=darkred]

Bing

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql? unsub...sie.nctu.edu.tw

Kishore Jalleda

2006-04-03, 11:26 am

------ =_Part_2514_31592508
.1144080251866
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

in port forwarding , all you are saying is !!ok, if server1 gets any
connection on port 3307 then forward that connection to port 3306 on
server2, so essentially the connection on server2 for Mysql is coming from
the client on server1 , so the user you are using to connect to server2 fro=
m
server1 has to have permissions to connect to server2 from server1 ( Note:
the user might have permission to connect to server2 from server2 itself,
but not from server1). So please add that permissions appropriately on
server2 as you told earlier

On server2
GRANT ... TO 'someuser''@'server1
' identified by 'password'

That would solve it ...

You also asked

if port forwarded connections are really taken as local

> connections???


in this case a connection on server1 was port forwarded to server2 , so
server2 does not see this connection as being local...

Kishore Jalleda
http://kjalleda.googlepages.com/projects


On 4/3/06, Bing Du <bdu@iastate.edu> wrote:
?[color=darkred]
have[color=darkred]
port[color=darkred]
>
> Yes, I understand the error message. What confused me was if I connected
> as 'myusername' directly on server2, there was not any problem at all as
> what was shown in the following in my original post. So in another word,
> 'myusername'@'localh
ost' was denied access if connecting via port
> forwarding, but it's allowed access if connecting from localhost. Hence m=

y
> question, if port forwarded connections are really taken as local
> connections???
>
>
> Bing
>
> --
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe: http://lists.mysql.com/mysql? unsub...ma
il.co=

m
>
>


------ =_Part_2514_31592508
.1144080251866--
Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2009 droptable.com