fbpx
Laptop rage

How to fix WordPress admin login issues after a database move

Laptop rage

How to fix WordPress admin login issues after a database move

I recently ran into a problem where I was unable to log into a website’s wp-admin area after a database move. As the main way to administer WordPress-made websites nowadays, it caused some panic. Thankfully though, there are ways to enable entry back into the site in these situations.

For some back story, I was migrating the contents of one website into a testing area, so I could extract its blog posts. I created a domain, pointed my hosts file at the IP address, and was able to get a default WordPress site up in minutes. The problem, however, came when migrating the said database into the new site. A new, fresh database was made and I imported the other website database into it through phpMyAdmin. With a few changes to the wp-config.php file, it was correctly pointing at the database that was once on another site. My problem now, however, was that I was booted out of wp-admin, and logging in wouldn’t work.

Here are the tips I found best helped to get out of this sticky situation.

First, determine what is happening when you try and log in. Is the domain of your test site being changed to the domain that was from the original website? Is the page simply refreshing? Are you able to instigate a password reset? Does the site work in a fresh browser? Does your site have plugins and themes installed? Is .htaccess getting in the way? These are all helpful questions to determine what could be causing your issue.

When I first found I couldn’t log in, I tried usernames from both the new website, as well as logins from the migrated database, but neither worked. Requesting a password reset didn’t work either, as you may expect when a database has been put in a new environment, so I took my backups and went to work.

The first tip I recommend is to check that it’s not an issue with your PC configuration. Oftentimes, cookies and caching settings can get in the way of website performance. By using a separate clean browser, you can ensure that the issue isn’t local to your device. Resetting your browser cookies and cache is a simple process, and guides for different browsers can be found freely online if you are unsure.

Should you still be having issues, like I did, my second tip is to enter your phpMyAdmin and edit your database – specifically the wp_users table, which you’ll be able to access through cPanel. In the table, you will be able to see the usernames assigned to that database. Click on the Edit button to the left to make amends to this account. In here, you’ll be able to reset the password directly.

image 1

In the user_pass value box, input the password you want to reset to. Change the Function of this field to ‘MD5’ to ensure that the encryption takes place and sets your password correctly. Click ‘Go’ to run and save the query.

image2

Should you still be experiencing login issues – and I still was – your next port of call will be the plugins and themes folders on your website. To ensure that they are not interrupting anything, I recommend renaming both of these folders in /wp-content. Simply renaming these folders will mean they no longer affect the website and resets it to a default state. To do this, log in to your site via FTP with a tool like Filezilla – your connection details will be in your cPanel.

If you still cannot login, then it’ll be worth renaming your .htaccess file too. This file dictates many of the redirection, caching, and other server configuration rules for your website. It can be found in the parent directory of your website, again accessible via FTP. The file itself is called “.htaccess” and may require you to enable the setting to view hidden files on your PC to edit this.

My final helpful troubleshooting step is to add two lines of code to your wp-config.php file. Again, this will require FTP access to your site. This wp-config file can be found in the top-level directory. Add these two lines of code (replacing example.com with your own domain), then save and re-upload the file:

define(‘WP_HOME’,’http://example.com’);
define(‘WP_SITEURL’,’http://example.com’);

I hope the above steps have regained your access to the wp-admin area of your website. If you’ve exhausted them and are still experiencing problems, speaking with your hosting provider may help.

Get in touch

Please enable JavaScript in your browser to complete this form.
Acceptance

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

>

Book a consultation with Engage Web