I have a fresh install of Centos 5.5 on a new VPS and MySQL seems unable to resolve the keyword 'localhost' - if I use 127.0.0.1 instead it works fine. I checked the /etc/hosts file which is as follows:
# Auto-generated hostname. Please do not remove this comment.
xxx.xxx.xxx.xxx 224136.xxxxxxxx.com localhost 224136 224136 localhost.localdomain
127.0.0.1 localhost
(I added the last line myself)...but still the localhost keyword isn't recognised. For example when I try to connect to my MySQL server using Navicat over SSH tunnel I get an error:
1130 - Host 'xxx.xxx.xxx.xxx' is not allowed to connect to this MySQL server
any ideas what might be the problem, thanks
Just for the sake of ruling MySQL is the culprit, please make sure you have root@localhost and [email protected] as separate users defined in MySQL.
Do the following to make sure root users can come into MySQL:
root@localhost connects via the mysql.sock file
[email protected] connects via TCP/IP
Until you get the networking issues straightened out, you may want to use the --protocol option of the mysql client to specify the protocol (tcp,socket,pipe,memory)
You already have localhost on first line of /etc/hosts. You should remove localhost from line beginning with 'xxx.xxx.xxx.xxx'