A: 

At the point where mysql receives the connection, all it has to identify the remote system is the IP address. It must then do a "reverse dns" lookup to convert the IP address of the requesting system to a hostname, so that it can look up the hostname in the authorization table. While you can map multiple hostnames to a single IP address, as you have done, there's no way for mysql to know which hostname was originally specified. At that point all it has is 127.0.0.1, and the DNS resolver will return the name 'localhost'. Even if changed that, you could give it only one name, so your scheme won't work.

You can however give your network adapter multiple DIFFERENT IP addresses. I don't know the details of setting this up on Ubuntu, but it should be relatively easy. Then you can set up multiple hostnames each with its own IP that connects back to your system. In your mysql setup specify the IP addresses instead of the hostnames in your GRANT commands to avoid having to mess with rDNS.

Jim Garrison
I tried setting up multiple ip addresses and connecting using new ip address. that is mysql -u root -h 192.168.9.2 -pBut it din work..... The Error I get is "Can't connect to MySQL server on '197.168.9.2' "
Karthick
You have 192.168.9.2 and **197**.168.9.2 -- was that a typo in your comment or was that the real message?
Jim Garrison
It was a typo..
Karthick
First, can you ping each separate address? Then, check that MySQL is listening on 0.0.0.0 and not 127.0.0.1 (`netstat -nat|grep 3306`). If it's on 127.0.0.1 you'll have to change the MySQL config.
Jim Garrison