Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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

Whenever I try to install mysql 5.0.77 on CentOS 5.5, the installation goes fine. So the whenever I try:

mysql -u root -p
Enter password: 
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

(Password is blank)

On investigating further I found that user table of mysql db is empty. Does anyone knows the solution to this problem.


share|improve this question

did you have an existing install and you upgraded? or is it a fresh install?

If you just installed it, you might try reinstalling the package after purging it.

If it was an upgrade, you can stop it, and run the daemon with:

/usr/sbin/mysqld --skip-grant-tables

then go into the client, create your username. Restart MySQL afterwards as running with skip-grant-tables runs your server with no authentication and any connection has root/grant privileges.

(not 100% sure on the path for mysqld as I run Debian, but, the method is the same)

share|improve this answer
Thanks. Its a fresh install. How can I purge the previous install? – Gautam Oct 15 '10 at 4:35
yum remove packagename;yum install packagename If that doesn't work, try running mysqld with --skip-grant-tables. – karmawhore Oct 15 '10 at 4:49
up vote 1 down vote accepted

Thanks karmawhore! The reinstall did not work. But I solved the problem by manually inserting root in mysql - user table using mysqld --skip-grant-tables.

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.