Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have the following repeated errors in my error.log and I don't know what it means or what I should/can do about it:

Access denied for user 'root'@'[some IP]' (using password: YES)

There are many different IPs showing in the [some IP] field.

I've been reading some security posts that recommend changing the root username to something else, is this something I should do here?

I am using MySQL 5.5.22

I believe these are attempts to gain access to my database from hackers. I want to know what I can do to prevent the attempts. Most of the IPs are coming from China.

share|improve this question
I am sure this question has been asked before.… This may be due to the fact that you need to explicitly giver permissions for user@IP combo to log into MySQL. – StanleyJohns Apr 15 '13 at 15:32
up vote 2 down vote accepted

My first answer is: why is your database even accessible from outside through the Internet? That network traffic really ought to be blocked by router Internet gateway router or firewall.

If you really need to allow some connections from the Internet to your database, then limit it to the valid IP address who should be connecting.

At this point that's not really a dba question but a network admin question.

share|improve this answer
+1 ... never a good idea for MySQL or any other service to be open to Internet without strong justification. Also worth mentioning, given OP's version, is the security vulnerability in versions before 5.5.24 had a serious potential security flaw these attackers might be trying to exploit. Official binaries were not affected but compiled-from-source and 3rd party builds may have been, depending on the underlying libraries used for the build: – Michael - sqlbot Apr 16 '13 at 1:42

Try the command below. Please review your options for security.


This will basically allow the root account to log in from any machine, which is a security risk.

Specify the IP to restrict the connecting hosts.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.