If for some reason, you cant remember your admin password for joomla, and your locked out of it completely. You can reset your password if theres no other way to get into joomla, providing you have access to the mysql database your Joomla is using.

You cannot recover the existing password, but you can reset it to a new password.
The passwords are stored using a one-way MD5 hash which prevents recovering the password.
But you can reset the password by editing the password field in the database.
Set the password to a known value and then you may log-in using that new password.

The password is stored in the MySQL database jos_users table password field. (change this for your table prefix if different)
Use a MySQL utility such as phpMyAdmin or MySQL Query Browser to edit this field.
Open the table, find your admin username, and then select that row for editing.
The password must be hashed, you cannot simply enter text into this field.

Set the password to a known value:
password = "this is the MD5 hashed password"
admin = 21232f297a57a5a743894a0e4a801fc3
secret = 5ebe2294ecd0e0f08eab7690d2a6ee69
OU812 = 7441de5382cf4fecbaa9a8c538e76783
Paste the hashed password into the field, save the change, and log-in using the new password.

Immediately change your password to something more secure!

For example, if I want to reset the "admin" users password back to "admin". I would look in the "jos_users" table, find the row where the username = "admin" and put "21232f297a57a5a743894a0e4a801fc3" for the password and save. That resets the password back to "admin"

Again, Immediately change your password to something more secure, once your logged into Joomla!