Sample Header Ad - 728x90

How I can proxy my connection in order to translate the host that I need to connect upon db?

3 votes
1 answer
49 views
I need to connect into a mysql via ssh tunnel:
ssh -N -L 33308:localhost:3306 myserver
And via terminal I try to connect into the mysql server using these commands:
mysql -u testusr -p -h 127.0.0.1 -P 33308 testdb
mysql -u testusr -p -h localhost -P 33308 testdb
The first attempt fails with message:
ERROR 1045 (28000): Access denied for user 'testusr'@'127.0.0.1' (using password: YES)
The latter one returns error:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
But if I get a terminal session upon the server I can connect with:
mysql -u testusr -p -h localhost testdb
But this command fails:
mysql -u testusr -p -h 127.0.0.1 testdb
with error:
ERROR 1045 (28000): Access denied for user 'testusr'@'127.0.0.1' (using password: YES)
The reason why is because the mysql authentication scheme uses both host and user for authenticating the user. I do no have administrative privilidges upon server in order to define the 'testusr'@'127.0.0.1'. Is there a way to proxy the connection and alter the connected user? If not how I can somehow connect via ssh to the server and execute the mysql command but have a gui tool that displays better the query results.
Asked by Dimitrios Desyllas (873 rep)
May 14, 2025, 02:46 PM
Last activity: May 14, 2025, 03:07 PM