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

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


I just got the same error after I restored mysql database like so:

mysql -h localhost -u root -p < mysql.backup.sql

mysql.backup.sql file comes from another server.

The problem seems to originate from the different password stored in /etc/mysql/debian.cnf in target and source systems. I copy/pasted the password line from source system's debian.cnf file to the file in target system. Then I was able to restart mysqld without any problems.

Note: I had to do killall mysqld before I could do a restart.


Sounds like you might have trashed the tables in the database ("mysql") that holds the credentials for accessing all the databases. Do you see anything in the MySQL logs (/var/log/mysql) that indicates a problem?

If there is corruption the approach to trying to fix it will depend on your storage engine. Are you using MyISAM (the default)? If so, try turning off the daemon and using myisamchk to attempt a repair.

If you can't repair, you will likely have to restore from backups (you have backups, right?) or reinitialize MySQL (probably just reinstalling the package through APT is easiest).

You might try over at ServerFault too for more suggestions from experienced sysadmins.

P.S.- if you have system super user access, you can reset the MySQL root password even if you can't login to MySQL, albeit through a somewhat convoluted procedure.


There is nothing stange or unusual.

The error means that password is incorrect.

If you want to change/reset the password, then take a look at this article - http://dev.mysql.com/doc/refman/5.1/en/resetting-permissions.html