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

I've imported my old database (via phpMyAdmin) and everything seemed to be fine - except for the user/password combinations. I tried to do a "FLUSH PRIVILEGES" and afterwards, I couldn't login anymore into my root account either (which was working).

I tried to reset it via stopping the mysqld, starting mysqld_safe with the --skip-grant-tables flag and reset the root password. It returned no error message, but when I tried to login I still got 'Access denied'.

Any idea of what might have gone wrong?

Thanks a lot!

PS: This is on a Debian 5.0.6 System

EDIT: Somehow my root account was gone. I had to repeat the steps again, reset all the other passwords in the mysql.user table and add a new root account via

mysql> INSERT INTO user VALUES ('localhost','root',password('newpass'),'Y','Y ','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y', 'Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','' ,'','','',0,0,0,0);
mysql> INSERT INTO user VALUES ('','root',password('newpass'),'Y','Y ','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y', 'Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','' ,'','','',0,0,0,0);

Now it's working again.

Thanks for all the replies! Cheers

share|improve this question
up vote 2 down vote accepted

just stop mysql [use kill if needed] and run it for a second with --skip-grant-tables option, change password for both root and debian-sys-maint password [so it matches one in /etc/mysql/debian.cnf ]

share|improve this answer

I don't know whether it does anything other than run mysqld_safe etc but I ran

dpkg-reconfigure mysql-server-5.0

and it gave me the option to reset the root password.

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.