“Help, I can’t log in to WordPress!” is one of the most common WordPress hosting support requests. Being locked out of WordPress is worrying, to say the least, but there’s no need to panic because you’re in the right place.
There are several reasons you might end up locked out of WordPress, and they are straightforward to resolve with cPanel & WHM. In this article, we look at four of the most common login problems and show you how to fix them. They are:
- Logging in when you have lost your password.
- Fixing the WordPress white screen of death.
- Repairing a database error that is stopping you from logging in.
- Regaining admin privileges when your user has lost them.
Fixing a Lost or Forgotten WordPress Password
- 1 Fixing a Lost or Forgotten WordPress Password
- 2 Fixing The WordPress White Screen of Death in cPanel
- 3 How to Disable WordPress Plugins without Logging In
- 4 Fixing Lost Administrator Privileges on WordPress
- 5 Fixing WordPress “Error Establishing a Database Connection” in cPanel
- 6 Simple Steps for Fixing WordPress Login Errors With cPanel
You’ve lost your WordPress password, and that means you can’t log in. In most cases, the built-in password reset tool is all you need. However, if you can’t access the email account that WordPress sends the reset link to, you’ll have to roll up your sleeves and edit the MySQL database.
Fortunately, that’s easy to do in cPanel. First, fire up phpMyAdmin, which you’ll find in the Databases section of the cPanel main page.
In the sidebar on the left, find the database for your site. It should look like yourusername_wp, but it may be different depending on your site’s configuration.
Click on the plus sign (+), and you’ll see a list of tables.
Click on the wp_users table, which is where usernames and passwords are stored.
Find your username in the user_login column, and click Edit at the beginning of that row. The hashed password is in the column next to your user’s login name, but don’t try to change it on this screen.
On the next screen, find the user_pass row and type a new password in the value column. In the function column, select MD5 from the dropdown menu. WordPress doesn’t store plaintext passwords. It runs the password through a hashing algorithm and stores the hash value. We have to replicate that by selecting the MD5 function.
Finally, click Go, and PHPMyAdmin will write the password hash to the database. You can now log in to your site with the new password.
Fixing The WordPress White Screen of Death in cPanel
Giving your user a new password is easy in cPanel, but what if the login interface doesn’t load at all? If you’re faced with a blank screen, you’re dealing with the White Screen of Death.
There are several possible causes, but the most likely is poorly written or conflicting plugins, so the first step is to disable all plugins.
How to Disable WordPress Plugins without Logging In
The strategy is to rename the folder that contains the plugin files. WordPress won’t be able to find the plugins, so they won’t be loaded.Open the cPanel File Manager from the Files section of the main page.
Navigate to your site’s directory, which is probably in the root or a subdirectory of public_html.
Navigate into the wp-content directory and click on the plugins folder.
Select Rename from the toolbar. Choose a name like “quarantined_plugins.”
Now try to log in. If you’re successful, rename the directory back to “plugins.” If WordPress continues to work, disable all the plugins in the WordPress interface and re-enable them one-by-one until the login error re-occurs. At this point, you have discovered the culprit.
If this method doesn’t work, you may want to consider restoring your site from a backup taken before the incident.
Fixing Lost Administrator Privileges on WordPress
Lost admin privileges are another common problem. You can log in to your site, but you don’t have access to features that require administrator privileges. This can happen if another admin user removes your access. It is also a common malware tactic, so you should run a malware scanner as soon as you regain access.
To regain your privileges, we’re going to create a new user account with the correct permissions. You can follow the same steps whenever you need to create a user from outside WordPress’s interface. It is possible to add privileges to an existing user, but this method is less complicated.
First, navigate to your database in phpMyAdmin, following the steps described in Fixing a Lost or Forgotten WordPress Password above. Find the wp_users table and click Insert.
Add the following information to the form’s Value field:
- ID: A number that is higher than the current highest user number. If you don’t know the highest number, use something like 100,000, depending on how many users your site has.
- user_login: A unique username. You will use this to log in. Do not use the same username as any other account on the site.
- user_pass: Enter a new password. Set the dropdown list in the function column to MD5. The second step is crucial; if you don’t set the function to MD5, you won’t be able to log in.
- user_nicename: Your name or nickname.
- user_email: your email address.
- user_url: your site’s URL.
- user_registered: Click on the calendar next to this field and select a date.
- user_status: Leave at 0.
- Display_name: the name WordPress should use in its interface.
When you’re done, the form should look something like this:
Take note of the ID, user_login, and user_pass values, because you’ll need them in the next step and to log in.
Click Go. Click Go again to confirm, and the new user is added to the database.
Next, we need to give the new user admin privileges. Go back to the main page for your database and click Insert next to the wp_usermeta table.
We need to add the admin privilege information to this database field and associate it with the new WordPress user via the user_id value.
- Leave the umeta_id field blank.
- Enter the user_id from the previous step.
- In the meta_key field, enter wp_capabilities.
- In the meta_value field, enter a:1:{s:13:”administrator”;b:1;}
As before, click Go on this page and the next page. That’s it! You can now use the details you added to the database to log in with admin privileges. Don’t forget to investigate why your account lost admin privileges in the first place.
Fixing WordPress “Error Establishing a Database Connection” in cPanel
Our final login blocker occurs because of database corruption, user error, or a compromised site. If you see “Error Establishing Database Connection” when you try to log in, it means WordPress is having a hard time talking to its database.
Several problems can cause this error, which is why we wrote an article that explains how to fix it. Take a look at How To Fix “Error Establishing a Database Connection” in WordPress to learn more.
Hosting clients often panic when they are locked out of WordPress, and that’s perfectly understandable: it’s hard to fix a problem when you can’t access the admin interface. However, with cPanel & WHM’s built-in tools, hosting clients and hosting providers can quickly and easily diagnose and resolve the most common log-in errors.
Simple Steps for Fixing WordPress Login Errors With cPanel
If you’re experiencing issues logging into your WordPress website and have access to cPanel, there are several troubleshooting steps you can take to diagnose and potentially fix the issue. Below are common solutions to WordPress login errors:
- Clear Browser Cache and Cookies: Sometimes, cached data and cookies can interfere with login. Start by clearing your browser’s cache and cookies.
- Reset Password from phpMyAdmin:
- Login to your cPanel dashboard.
- Under the
Databases
section, click onphpMyAdmin
. - Select the database used by your WordPress site.
- Find and click on the
wp_users
table (note: the “wp_” prefix might be different if you changed it during installation). - Find your user account, click on
Edit
. - In the
user_pass
column, enter your new password. From the dropdown menu, selectMD5
and then clickGo
.
- Deactivate Plugins: Sometimes, a rogue plugin can cause login issues.
- Access the
File Manager
in cPanel or connect via FTP. - Navigate to
wp-content
. - Rename the
plugins
folder to something likeplugins_old
. This will deactivate all plugins. - Try logging in again. If it works, the issue is with one of the plugins. Rename the folder back to
plugins
and activate each plugin one by one until you find the problematic one.
- Access the
- Switch to Default Theme:
- In the same
wp-content
directory, navigate tothemes
. - Rename your current theme’s folder (e.g.,
my_theme
tomy_theme_old
). - WordPress will default to using one of the default themes (e.g., Twenty Twenty).
- Try logging in. If it works, the issue may be with your theme.
- In the same
- Check .htaccess File:
- From cPanel’s
File Manager
or via FTP, look for the.htaccess
file in your WordPress root directory. - Rename it to
.htaccess_old
to disable it. - If you can now login, the .htaccess file was the issue. Regenerate it by going to
Settings
>Permalinks
in your WordPress dashboard and simply clickingSave Changes
.
- From cPanel’s
- Check Site URL: If you recently moved your site or changed the domain, the URLs might be incorrect.
- Access
phpMyAdmin
from cPanel. - Open your WordPress database.
- Check the
wp_options
table. - Ensure the
siteurl
andhome
values are correct.
- Access
- Increase PHP Memory Limit:
- Edit the
wp-config.php
file from the root directory. - Add or modify the line:
define('WP_MEMORY_LIMIT', '256M');
- Edit the
- Check for Corrupt WordPress Files:
- Download a fresh copy of WordPress from the official website.
- Via FTP or cPanel’s
File Manager
, upload and overwrite thewp-admin
andwp-includes
folders.
- Check Database Connection: If you see a “database connection error”, ensure your
wp-config.php
file has the correct database name, username, password, and host. - Restore from Backup: If you have a recent backup of your site (and you should!), consider restoring it.
If none of the above solutions work, there might be a more specific or deeper issue with your site, and you may need to consult with a WordPress specialist or your hosting provider’s support.