Mysql can not resolve hostnames when checking privileges
Posted
by
Fabio
on Server Fault
See other posts from Server Fault
or by Fabio
Published on 2011-02-16T15:06:39Z
Indexed on
2011/02/16
15:27 UTC
Read the original article
Hit count: 458
I'm going crazy to solve this. I have a mysql installation (on machine db.example.org
) which doesn't resolve a given hostname. I gave privileges using hostnames i.e.
GRANT USAGE ON *.* TO 'user'@'host1.example.org' IDENTIFIED BY PASSWORD 'secret'
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, INDEX ON `my_database`.* TO 'user'@'host1.example.org'
However when I try to connect using mysql -u user -p -h db.example.org
I obtain
ERROR 1045 (28000): Access denied for user 'user'@'192.168.11.244' (using password: YES)
I already checked for correct name resolution in the dns system:
$ dig -x 192.168.11.244
;; ANSWER SECTION:
244.11.168.192.in-addr.arpa. 68900 IN PTR host1.example.org.
I've also checked for skip-name-resolve
option in mysql variables in fact if I can access from another machine on the same subnet using hostname privileges.
The only difference is that host1.example.org
and db.example.org
point the same ip on the same machine i.e. both db.example.org
and host1.example.org
have ip 192.168.11.244. In this way all the applications using that database can use the name db.example.org
and we can move the data on other hosts (if needed) just by changing the dns record, leaving the application code unchanged.
What should I do to solve this or at least to understand what's happening?
© Server Fault or respective owner