If your WordPress blog gets hacked, the hacker may change password and admin email as well. E-mail password reset method may not work. That time you need to change wordpress password from database.
Every host provides MySQL editor, phpMyAdmin. You need to launch phpMyAdmin from your cpanel. (Tip: It’s always better to have different password for hosting and wordpress admin.)
Step 1: In phpMyAdmin go to your wordpress database.
Step 2: From left panel select users table. usually wp_users , assuming wp_ is your prefix.
Step 3: Edit your desired username by clicking pen icon from the row.
Step 4: Go to Md5 hash generator and generate a Md5 hash for your password. ( WordPress passwords are stored as Md5 hashes, it is recommended to change your password if you were hacked)
Step 5: Copy the generated Md5 hash(highlighted above) . Go to page opened in step 3 in phpMyAdmin.
Step 6: Paste the copied hash into “user_pass” column and press Go.
You’re done. Go to your login page and login with new password. Happy blogging.