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.

3 Answers 3


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


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


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;


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .