Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Hi on one of my server I have installed a lot of softwares where in for each application I have created a user name and password.After that these applications have been running.Now I have to remove these applications and install the latest version of softwares.I have to basically make every thing work from scratch.My problem is I have forgotten the user name and passwords for some of these databases.There are other user applications also if I completely remove mysql and then install every thing that will work for me but other applications will stop working. Is there a way I can recover or even reset these password I have a root account to database so if recovery is not possible I at least want to reset and delete these databases.All the accounts are on mysql.

share|improve this question
add comment

3 Answers

up vote 7 down vote accepted

You can't recover the passwords as they are stored in an encrypted format but you can reset them if you have access to the mysql program with suitable privileges.

Get a list of the users that mysql knows about like this

mysql -u root -p
enter your root password

mysql select user,host from mysql.user;
+------------------+-------------+
| User             | Host        |
+------------------+-------------+
| root             | localhost   |
| user1            | localhost   |
| user2            | localhost   |
+------------------+-------------+

Now you have a list of the users you can set the passwords to something you can remember

mysql> set password for 'user2'@'localhost' = PASSWORD('SomeNewPassword');

There is more on this in the mysql reference manual

share|improve this answer
    
Hi thanks for your message it clarifies my doubt. –  Registered User Feb 3 '11 at 5:46
add comment

If your software apps are mainly CMS and other similar stuff, you can get username and password in config file of each app. I suppose you use a LAMP configuration, so probably you'll find these config files in php web directories.

From your description is not clear if you use mysql as authentication system or if you use it only to store app db

share|improve this answer
add comment

If you have the root account you can easily get user names from a mysql console using the following SQL query: select User from mysql.user;

share|improve this answer
    
Thanks I was not clear on this part only. –  Registered User Feb 3 '11 at 5:46
add comment

Your Answer

 
discard

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.