vote up 2 vote down star

I have a MySql database that I "inherited" and I was not given the admin credentials. I do however have access to the box that it runs on. Is there a way to either recover the admin credentials or create new ones?

flag

2 Answers

vote up 11 vote down check

Read and execute the chapter about resetting the root password in the MySQL Reference Manual.

link|flag
vote up 2 vote down

If this is a Debian/Ubuntu box, there is a special root-equivalent account called debian-sys-maint. You can read the password in /etc/mysql/debian.cnf

Using that password you can log into mysql as debian-sys-maint using:

mysql -udebian-sys-maint -p

Once you are logged in, do the following:

use mysql;
update user set password=password('<new password>') where user='root';
flush privileges;
quit;

root should now be accessible using your new password:

mysql -uroot -p
link|flag

Your Answer

Get an OpenID
or
never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.