LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (http://www.linuxquestions.org/questions/linux-software-2/)
-   -   mysql: debian-sys-maint password changed by accident, possible to change it back? (http://www.linuxquestions.org/questions/linux-software-2/mysql-debian-sys-maint-password-changed-by-accident-possible-to-change-it-back-216586/)

ldp 08-12-2004 04:52 AM

mysql: debian-sys-maint password changed by accident, possible to change it back?
 
Hi,
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.

kind regards.
Lieven

ldp 08-12-2004 06:00 AM

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.
rgds.

jlinkels 08-12-2007 07:31 PM

Thanks for the tip. I helped me out after I did the same.

jlinkels

stioanid 06-01-2009 04:12 AM

Quote:

Originally Posted by ldp (Post 1104153)
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.
rgds.

Because I have the same problem with mysql and I can restart it.
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.

geodrummer55 02-17-2010 10:36 AM

Quote:

Originally Posted by stioanid (Post 3558712)
Because I have the same problem with mysql and I can restart it.
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.

RedScourge 03-22-2010 11:54 AM

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

ckuttruff 02-22-2013 03:57 PM

Thanks for the info...
 
Quote:

Originally Posted by RedScourge (Post 3907709)
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

Appreciate your comment... had an absurdly difficult time finding info about which privileges are really necessary and why for this user.

Fwed 08-29-2014 04:57 AM

removed


All times are GMT -5. The time now is 01:51 PM.