DNS lookups slows down MySql

PDF
Access to a MySql database is granted based on username in combination with the hostname and a password. MySql will first try to lookup the hostname in the cache, if not found it tries to resolve the hostname. DNS resolution might become a performance issue. MySql will do a double reverse-DNS lookup, it will first lookup the hostname which belongs to the incoming ip-address, then it will lookup the ip-address belonging to the hostname and matches the incoming ip-address with the found ip-address by the DNS resolution. This all might work well, but it all relies on a good DNS infrastructure. Now what if the DNS server can not be reached? or the reverse DNS mappings do not match? In that case users might not be able to connect to the MySql server. To prevent this you should edit your MySql configuration and set skip_name_resolve in /etc/my.cnf If you already have your MySql server running you should convert the hostnames in the users table before restarting the mysqld daemon. Run the query:
SELECT user, host FROM mysql.user WHERE host RLIKE '[a-z]' AND host  'localhost';
to find the users and hostnames to be changed to ip-addresses. After changing the hostname into ipaddresses your can safely restart your MySql server
/etc/rc.d/mysqld restart
 

Please login first before adding a comment.

Search






You are here: Home Howtos and FAQs MySql DNS lookups slows down MySql