MySQL unauthenticated login pile-up

Sometimes MySQL's process list will fill with unauthenticated login entries that look like this:

| 971 | unauthenticated user | xxx.xxx.xxx.xxx:35406 | NULL | Connect | NULL | login | NULL |

Generally, this means one of two things are happening. First, this could be a brute force attack against your server from an external attacker. Be sure to firewall off access to port 3306 from the outside world or run MySQL with skip-networking in the /etc/my.cnf file, and that should curtail those login attempts quickly.

However, MySQL could be attempting to resolve the reverse DNS for each connection, and this definitely isn't necessary if your grant statements refer to remote machines' IP addresses rather than hostnames (as they should). In this case, add skip-name-resolve to your /etc/my.cnf and restart MySQL. These connection attempts should authenticate much faster, and they shouldn't pile up in the queue any longer.

Note: Connections via sockets aren't affected by DNS resolution since sockets don't involve any networking access at all. If your web applications use 'localhost' for their connection string, then MySQL won't bring DNS resolution into play whatsoever.

Recommended reading: 6.5.9. How MySQL Uses DNS

Printed from: http://rackerhacker.com/2007/08/16/mysql-unauthenticated-login-pile-up/ .
© Major Hayden 2012.

4 Comments   »

  • Claudio says:

    skip-name-resolve

    Thanks!
    This solved my long-lasting mysql problem on a multi-server configuration.
    I googled long time last months in order to find a solution to this problem, but unfortunately this page didn't contain the keyword "hang", so I only found lots of other people looking for a solution to this problem - witout an answer.
    Thanks again. :)

  • Pav says:

    Thanks a lot it solve muy problem of MySQL unauthenticated login this was the DNS issue my be DNS very slow I added skip-name-resolve to my.cnf file then restarted the mysql after that it stop giving my this error and mysql server get faster as well

    Thanks

  • miguelss says:

    Thanks, you made may day!!!!

  • RedScourge says:

    also can often solve issue by fixing your DNS, if DNS is failing this will cause long delays until timeout. probably best to skip instead, no reason to require a DNS lookup per connection!

Trackbacks/Pingbacks

  1. Plantage Mysql « MemInfo

RSS feed for comments on this post

Leave a Reply

 

  • Welcome! I started this blog as a way to give back to all of the other system administrators who have taught me something in the past. Writing these posts brings me a lot of enjoyment and I hope you find the information useful. If you spot something that's incorrect or confusing, please write a comment and let me know. Drop me a line if there's something you want to know more about and I'll do my best to write a post on the topic.
    -- Major Hayden

    Flattr this