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

Got a problem with a mysql server installation on Debian. (Not my server so I have no idea what caused this...)

Installing new applications that add a database fail with error:

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

I can log in with the user, I've flushed permissions...

Then I can across this question:

But when I try to stop mysql, it fails with

error: 'Access denied for user 'debian-sys-maint'@'localhost' (using password: YES)'

share|improve this question

2 Answers 2

up vote 4 down vote accepted

Debian use debian-sys-maint account for management (start/stop etc.). Credentials are stored in /etc/mysql/debian.cnf - check if all are valid.

share|improve this answer

There are many ways of restoring the debian-sys-maint user. Most easy to do is to reconfigure package mysql-server-5.5. That if you know the password for the root user of MySQL, you can try to restore the user and its password in /etc/mysql/debian.cnf.

sudo dpkg-reconfigure mysql-server-5.5

To restore MySQL:s root password (or any MySQL-users password) you can use the debian-sys-maint account. You need to run mysql to get the password for the debian-sys-maint account.

sudo mysql --defaults-file=/etc/mysql/debian.cnf
mysql> UPDATE mysql.user SET Password=PASSWORD('secret') WHERE User='root';
mysql> QUIT;

So, never remove the user debian-sys-maint, as it is used in Debian to administrate MySQL (shut it down, roll logs, upgrade packages, check existans of root user in MySQL, set new root user password etc).

share|improve this answer
In my case i just sudo killall mysqld then run sudo dpkg-reconfigure mysql-server-5.5, Now everything is ok. –  shgnInc Mar 6 at 19:26

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.