Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm completely confused with the CentOS's mysql server. It's 5.0.77 from CentOS 5.5.

I can't seem to create a user on that server. I've disabled the old_password option and restarted. I created a new user with:

GRANT SELECT ON db.table TO username IDENTIFIED BY 'some password';

It was correctly hashed to the new type password in mysql.user... but every time I try to login (either over socket, or network) I get:

ERROR 1045 (28000): Access denied for user 'username'@'localhost' (using password: YES)

I've never had problems with that in any other distro. Is there something centos-specific in the standard mysql package? How can I fix this situation?

share|improve this question

1 Answer 1

up vote 2 down vote accepted

The user must have access to log on from localhost Add the user again with:

GRANT SELECT ON db.table TO 'username'@'localhost' IDENTIFIED BY 'somepass';

Then you should be able to log on from localhost.

share|improve this answer
    
Yes, that works, but why? Unless I missed some exceptions in the database, 'username'@'%' should match any connection anyways. –  viraptor Feb 16 '11 at 23:58
    
Ok - I just noticed the sorting rules and centos putting ''@'localhost' in the database by default. Silliness removed and now everything works as it should :) –  viraptor Feb 17 '11 at 0:03

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.