Take the 2-minute tour ×
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. It's 100% free, no registration required.

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. dba.stackexchange.com/questions/19212/… 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
add comment

2 Answers

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  
+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: seclists.org/oss-sec/2012/q2/493 –  Michael - sqlbot Apr 16 '13 at 1:42
add comment

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

GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'enter_password_here' WITH GRANT OPTION;

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.

GRANT ALL PRIVILEGES ON *.* TO 'root'@'[IP]' IDENTIFIED BY 'enter_password_here' WITH GRANT OPTION;
share|improve this answer
add comment

Your Answer

 
discard

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.