MySQL DNS issue: skip-name-resolve connection fast but cannot log into email

dnsMySQL

MySql is used here with remote network connections, and after a reboot of the server these connections started taking 20-30 seconds to connect causing timeouts. Connections used to be nearly instant.

Adding skip-name-resolve fixes the delay as remote connections address the database by its IP address, however, this MySql server also hosts an email login database for an internal email server. The skip-name-resolve fix breaks all email logins from clients and servers.

The email server is a Postfix/Dovecot stack and using IMAP RoundCube Server and Thunderbird clients. I cannot figure out where in the email stack that addresses MySql configuration needs to be changed.

It seems the root of the problems would be a DNS issue, maybe an expired domain name in the configs somewhere. I spent hours looking and need some advice on tackling this. I'd rather solve the root DNS issue, if that's the problem – like track down an expired domain name or fault in the DNS addressing.

Best Answer

Workaround:

Keeping skip-name-resolve in place, I changed shunned users having non-IP number hostnames in the users table as follows:

UPDATE mysql.user SET Host='127.0.0.1' WHERE Host='localhost' AND User='username';
UPDATE mysql.db SET Host='127.0.0.1' WHERE Host='localhost' AND User='username';
FLUSH PRIVILEGES;

I will delve into the DNS problem when I have a spare weekend.

(Changed % to 127.0.0.1 as requested in a comment, as with % everyone would be able to access MySQL with username, with no IP checks. localhost is resolved as 127.0.0.1 in most cases (see your /etc/hosts). - [ed.])