0

Is there a way to get back / retrieve a mysql root password.

I mean get it back : not resetting it (I already know how to reset it and I use the reset method currently).

  • That will be hard. I know this is not a solution just a comment, try history | grep mysql -p maybe show something interesting, and .bash_history from users that accessed the server. Because mysql accept password directly in command line, and some users use in that bad way. – Luciano Andress Martini Feb 21 at 20:06
3

I usually have moderate success retrieving lost root MySQL passwords from MySQL history logs (e.g. .mysql_history log files). Also frequently applications are also a data trove for finding privileged passwords. Often root passwords are (mis)used for applicational use. Also, more rarely, as @Luciano says, you can also found MySQL password(s) in the shell history logs, if the user is not careful and uses the password in the command line.

As for the actual MySQL user tables, they are in an hash format. For practical purposes, it is not possible to get back the actual original password from there.

Unfortunately, as you imply in the question, failing getting the password from logs or applications (or from someone), the best course of action, is indeed resetting it anew.

  • As for the actual MySQL user tables, they are in an hash format, and it is not possible to get back the actual original password from there. -> theorically – Luciano Andress Martini Feb 21 at 20:12
  • @LucianoAndressMartini yeah, the computational effort to do that is not practical even less as newer versions are using stronger algorithms. – Rui F Ribeiro Feb 21 at 20:13
  • If the password is weak maybe only maybe it is possible to break the hash using bruteforce, john the ripper or somerhing like this. but yes ;... it is hard or impossible in practice. – Luciano Andress Martini Feb 21 at 20:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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