I want to connect to remote MySQL through an ssh tunnel with a user with "localhost" access.
I use this to create a tunnel:
ssh -f -N -L 33306:localhost:3306 user@remote-host
and to connect to the host:
mysql -h 127.0.0.1 -P 33306 -uuser -ppassword
The error I am getting is:
ERROR 1045 (28000): Access denied for user 'user'@'remote-host' (using password: YES)
The problem is that the user '@' remote host '(or' user '@'% ') does not exist, only' user '@' localhost 'does.
Is there a way to make the remote host without changes on the server side think that I came from localhost? This is the only reason I could connect through the ssh tunnel.
Note:
If I want to connect to this command:
mysql -h localhost -P 33306 -uuser -ppassword
I get this error:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
Additional data:
On a remote server in / etc / hosts, the values ββare as follows:
127.0.0.1 localhost remote-ip remote-host
alesf source share