cPanel® Blog

Fixing WordPress Login Errors With cPanel

“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

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. 

As always, if you have any feedback or comments, please let us know. We are here to help in the best ways we can. You’ll find us on Discord, the cPanel forums, and Reddit.

cPanel

The web hosting industry's most reliable management solution since 1997. With our first-class support and rich feature set, it's easy to see why our customers and partners make cPanel & WHM their hosting platform of choice. For more information, visit cPanel.net.