You may have simply forgotten your password, or you may have been doing some mods in a haphazard fashion. The reason doesn’t matter much; the fact is, you’re locked out and you just want to access your site again, right?
Gaining access to your site again isn’t too hard, so long as you’ve got access to your hosting account.
Log in to your database
Once you’ve logged into cPanel (or you host’s equivalent control panel, if you don’t have an awesome host like HostGator), find the phpMyAdmin icon so that you can make changes to your database and log in to phpMyAdmin.
Once you’re logged in, find the users table. If you haven’t changed your table prefix, the table will be wp_users, though I’ll take this opportunity to recommend that you change it now. If you have changed the prefix, it will be yourcustomprefix_users.
Once you browse the table, you’ll see one or more rows, each one representing a user on your site. You should be able to identify your row by the user_login column, which will include the login that you normally use to log into WordPress.
Reset your password
Click on the Edit link on the row for the user you’re trying to reset the password for. The next screen will enable you to change all of the raw data for that user, including their email address, display name and most importantly, their password.
At first glance, you might realise that the value in user_pass (the password field) doesn’t look like the password that you thought it was. That’s because it’s encrypted, so that it can’t easily be stolen, by someone who might have gained access to your database for instance. As such, it’s not quite as simple as writing your new password in that field; you need to encrypt your new password first.
Encrypt your password
There are tools all over the place that will allow you to encrypt your password. You’ll want to find a tool that encrypts data using MD5 encryption. This password encryptor does the job nicely. Once you’ve received the encrypted password, which should be a very long, random mix of letters, numbers and symbols, you can then paste that into the user_pass field in phpMyAdmin and save the row.
Your password is now reset and you should be able to log back in to WordPress. Now, be a little more careful in future!