Resetting Mysql Debian System Maintainer account

03:13PM Mai 24, 2009 in category Linux & Co by Alexander Pirsig

If you're receiving the following error that means that your system maintainer account was overwriten and mysql is not able to startup correctly. It happend to my because I used "mysqldump" with "--all-databases" flag which also dumps the "information_schema"- and "mysql"-Database. If you restore this dump to another system you'll overwrite your system maintainer account password.
root@pirsig-t61:~# /etc/init.d/mysql start
 * Starting MySQL database server mysqld                                                              [ OK ] 
 * Checking for corrupt, not cleanly closed and upgrade needing tables.                                      
/usr/bin/mysqladmin: connect to server at 'localhost' failed                                                 
error: 'Access denied for user 'debian-sys-maint'@'localhost' (using password: YES)'                         
root@pirsig-t61:~# ERROR 1045 (28000): Access denied for user 'debian-sys-maint'@'localhost' (using password: YES)  

Get the ORIGINAL password

First of all we need to get the you local system maintainer password. Open /etc/mysql/debian.cnf and copy the password from entry "password" in my case its "XXXXXXXXXXXXXXXX".
# Automatically generated for Debian scripts. DO NOT TOUCH!
[client]
host     = localhost
user     = debian-sys-maint
password = XXXXXXXXXXXXXXXX
socket   = /var/run/mysqld/mysqld.sock
[mysql_upgrade]
user     = debian-sys-maint
password = XXXXXXXXXXXXXXXX
socket   = /var/run/mysqld/mysqld.sock
basedir  = /usr

Reset password

Login to your mysql server and check that your sys-maintainer account exists.
show grants for 'debian-sys-maint'@'localhost';

GRANT ALL PRIVILEGES ON *.* TO 'debian-sys-maint'@'localhost' IDENTIFIED BY PASSWORD 'YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY' WITH GRANT OPTION
Finally reset you password with the value of debian.cnf with the following statement:
GRANT ALL PRIVILEGES ON *.* TO 'debian-sys-maint'@'localhost' IDENTIFIED BY 'XXXXXXXXXXXXXXXX' WITH GRANT OPTION;
Important: It's very important to use "IDENTIFIED BY" clause because "IDENTIFIED BY PASSWORD" uses a password hash and not the clear password as "IDENTIFIED BY does.

Kommentare[0] Tags: debian debian.cnf password error ubuntu error-1045 mysql debian-sys-maint

Kommentare:

Senden Sie einen Kommentar:
  • HTML Syntax: Ausgeschaltet