Redirect localhost:3306 to another machine?

patrik

Verified User
Joined
Sep 6, 2006
Messages
126
Is it possible to redirect local mysql traffic to another machine? We need to move MySQL to a dedicated machine without to much trouble for the existing customers. For all of those customers connecting to localhost, would it be possible to tranparently redirect that traffic to the dedicated machine?
 
I was able to tunnel traffic with SSH:
Code:
ssh user@hostdestination -N -f -L *:3306:hostdestination:3306
But still, if I try to connect to MySQL on localhost it tries to go through mysql.sock which of course doesn't go through any tunnel:

Code:
# mysql -h local_hostname
ERROR 1045 (28000): Access denied for user 'root'@'hostdestination' (using password: NO)
# mysql -h localhost
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
Can I disable use of mysql.sock or tunnel traffic through this socket too?
 
Back
Top