Mysql – force thesql server to resolve the external ip to localhost

MySQL

I'm finally succeeded with ssh tunneling. My point is to open the mysql server to local users only (user@localhost etc.) while providing a remote control to my customers through ssh tunneling.

The problem is when I connect through the mysql command line tool (mysql.exe -u root -h 127.0.0.1 --port=8600) I've got a permission denied error for user root@my.servers.ip.address (the tunnel redirects from 127.0.0.1:8600 to my 3603 remote server)

Well it makes sense since my root exists in mysql.user only with the localhost host.

But then, is there a way for me to somehow tell mysql that this ip address is actually the server's address and that the root should be allowed to connect?

I've got no clue where to start. To me if such a thing existed it would be some kind of ip resolving table…

Best Answer

Great, here is the solution I found. I'm chosing to post it here instead of just removing the question since I believe it may be relevant for further reference.

Basically the idea is to leave mysql alone but to tell the server to resolve the ip. In the case of my centos6 configuration it means editing the /etc/hosts file and appending a my.servers.ip.address localhost line into it.

Hope it helped! S.