SSH tunnel MySQL traffic: BOTH remote & local?

SSH tunnel MySQL traffic: BOTH remote & local?

Post by Gary.Ev.. » Sat, 05 Jan 2002 01:44:27



Using the -h <hostname or IP> should do it.
mysql -h 10.129.0.2 -u user -p password yadayadayada
-----Original Message-----

Sent: Thursday, January 03, 2002 10:28 AM

Subject: SSH tunnel MySQL traffic: BOTH remote & local?

If I've got one computer with MySQL client and server on it, running
everything localhost,

but I want to reach out to another MySQL server, through an SSH tunnel, for
some things,

does anyone know how to differentiate between the two?

Usually, for SSH tunnelling, you access a port # at localhost, but if I also
need that port # at localhost, (3306), what's a guy to do?

Any advice appreciated.

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


To unsubscribe, e-mail

Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

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



Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

 
 
 

SSH tunnel MySQL traffic: BOTH remote & local?

Post by John Barto » Sat, 05 Jan 2002 02:29:37


Try mapping your remote mysql to a different local port, then specify that
port number when you connect.

For example:
'ssh -L 3307:hostip:3306 hostname' will map port 3306 on the remote machine
to port 3307 on your local machine. Then, use
'mysql -P 3307 -u xxxxx -p etc.' to connect to port 3307 on your local
machine, and you will hit your remote mysql

> Using the -h <hostname or IP> should do it.
> mysql -h 10.129.0.2 -u user -p password yadayadayada

> -----Original Message-----

> Sent: Thursday, January 03, 2002 10:28 AM

> Subject: SSH tunnel MySQL traffic: BOTH remote & local?

> If I've got one computer with MySQL client and server on it, running
> everything localhost,

> but I want to reach out to another MySQL server, through an SSH tunnel,
> for some things,

> does anyone know how to differentiate between the two?

> Usually, for SSH tunnelling, you access a port # at localhost, but if I
> also need that port # at localhost, (3306), what's a guy to do?

> Any advice appreciated.

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


> unsubscribe, e-mail

> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

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


> unsubscribe, e-mail

> unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

John Barton

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



Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

 
 
 

SSH tunnel MySQL traffic: BOTH remote & local?

Post by Hershey, Erni » Sat, 05 Jan 2002 02:42:33


        Yeah, you could use SSH to forward local port 9999 or some other
random port to the remote 3306, with something like: ssh -N -f -L

Then to connect to the other machine via the ssh tunnel, run the client and
connect to that port on localhost, with something like: mysql -h localhost
-P 9999  -u otherserverusername otherserverdatabasename.

Ernie Hershey

-----Original Message-----

Sent: Thursday, January 03, 2002 11:56 AM
To: MySQL baby


Subject: Re: SSH tunnel MySQL traffic: BOTH remote & local?

You use a different  port # for the tunnel.


> If I've got one computer with MySQL client and server on it, running
everything localhost,

> but I want to reach out to another MySQL server, through an SSH tunnel,
for some things,

> does anyone know how to differentiate between the two?

> Usually, for SSH tunnelling, you access a port # at localhost, but if I
also need that port # at localhost, (3306), what's a guy to do?

> Any advice appreciated.

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


> To unsubscribe, e-mail

> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

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



Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

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



Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

 
 
 

SSH tunnel MySQL traffic: BOTH remote & local?

Post by Hershey, Erni » Sat, 05 Jan 2002 02:47:20


        Yeah, you could use SSH to forward local port 9999 or some other
random port to the remote 3306, with something like: ssh -N -f -L

Then to connect to the other machine via the ssh tunnel, run the client and
connect to that port on localhost, with something like: mysql -h localhost
-P 9999  -u otherserverusername otherserverdatabasename.

Ernie Hershey

-----Original Message-----

Sent: Thursday, January 03, 2002 11:56 AM
To: MySQL baby


Subject: Re: SSH tunnel MySQL traffic: BOTH remote & local?

You use a different  port # for the tunnel.


> If I've got one computer with MySQL client and server on it, running
everything localhost,

> but I want to reach out to another MySQL server, through an SSH tunnel,
for some things,

> does anyone know how to differentiate between the two?

> Usually, for SSH tunnelling, you access a port # at localhost, but if I
also need that port # at localhost, (3306), what's a guy to do?

> Any advice appreciated.

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


> To unsubscribe, e-mail

> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

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



Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

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



Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

 
 
 

1. mysql & ssh tunneling

Hi experts!
I want to use SSH tunneling to securely create a connection between my
Windows host
and a Linux (SUSE 7.2) Server running MySQL 4.0.13.

I established the tunneling connection, and a
mysql -h localhost -u foo -pbar mysql
connects me nicely to the server.

However, if I use the
mysql_real_connect(...)
the host hangs.

Are there some flags I have to use? The SSH-flag (2048) gives the same
result.

Regards,
Tobias Schittkowski

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql

2. FA: Compaq PC Companion C140

3. Subject: Mini-HOWTO: MySQL over SSH tunnel

4. Screen Protector on E100?

5. tunneling mysql client connections with ssh

6. editing several files in an already opened VIM

7. Using ssh tunnel and mysql

8. auth and ssh tunnel

9. Lost connection during query when using SSH tunneling

10. tunneling database connections through ssh

11. SSH tunnel

12. Ignoring username parameter when connecting via ssh tunnel