mysql: debian-sys-maint password changed by accident, possible to change it back?
I have mysql running on my knoppix debian distribution. It works fine and all that but it seems that the /etc/init.d/mysql script to start/stop the deamon uses a mysql userid: debian-sys-maint
Problem is that I accidently changed the password for this user. Is there a way to find out the original password so I can put it back?
I found also a file /etc/mysql/debian.cnf in which I see the user and his encrypted password. I googled this a few times but no solutions found so far. Is it even possible to change this password?
I mean, I can change the password in the mysql.user table but there's no script to change it in the debian.cnf file.
I already tried to put the encrypted password from the debian.cnf file directly in the mysql.user table for the debian-sys-maint user but that don't seem to help.
any help welcome.
I found out how to get it working again.
It seems that the password in the /etc/mysql/debian.cnf file is just a plaintext password altough it looks like an encrypted one. (it has the same amount of random characters like all other encrypted passwords in the mysql.user table)
So instead of putting the pwd directly in the table, I used the password() function to encrypt it and now it works fine again.
Thanks for the tip. I helped me out after I did the same.
Can you please provide the exact command you typed.
What I did is to copy password from /etc/mysql/debian.cnf and had it copied inside the following command
GRANT ALL PRIVILEGES ON *.* TO 'debian-sys-maint'@'localhost' IDENTIFIED BY 'password from debian.cnf' WITH GRANT OPTION;
but i think it didn't work because when I run
mysql -u root -p'password from debian.cnf'
I get the following
Access denied for user 'debian-sys-maint'@'localhost' (using password: YES)
I can just restart it to try it because it's a production machine and can't go offline.
Last time I try it, it wouldn't start back-up and I had to remove /etc/mysql/my.cnf in order to start it.
If you have PHPMyAdmin installed then you can log in as root, then change the debian-sys-maint users password to the one from the debian.cnf file without having to encrypt it or anything.
You do NOT need to grant all permissions, this is a bad habit to get into from a security standpoint.
All you need to grant is this (as root or whoever):
GRANT SHUTDOWN ON *.* TO 'debian-sys-maint'@'localhost';
GRANT SELECT ON `mysql`.`user` TO 'debian-sys-maint'@'localhost';
Because it needs to shutdown/startup, and does a test select from the users table as a sanity check to ensure the root user exists. This select is usually done by /usr/share/mysql/debian-start.inc.sh which is loaded by /etc/mysql/debian-start
Thanks for the info...
|All times are GMT -5. The time now is 02:45 AM.|