MySQL Reverse DNS lookups are often the cause of long delay and slow MySQL performance when running certain SQL queries. This problem can be fixed by disabling MySQL reverse dns lookup. This is a server-side MySQL configuration, and you need to restart MySQL server to reflect the result.
For older installations, execute below command:
For newer installations, execute below command:
Locate the mysqld block, and add below line:
After the change, it should look like in the below image:
Save the file and restart MySQL server.
service mysql restart