Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

After moving Wordpress, login works, but no admin access anymore

After transferring a wordpress from an old ISP to a new ISP, I have trouble with the admin access / access to the dashboard.

The transfer was done by copying all files (incl. .htaccess) from the old server to the new server, dumping the old DB and putting it on the new server and adjust all settings for DB in wp-config.php.

By setting a hosts entry on my machine, I could verify that everything is working fine and all content appears.

Here is my problem.

After logging in thru wp-login.php with old and new credentials (manually added admin account for example) the login is happening, redirecting me to the website, stating successful login by the login bar on the top of the page, but access to the dashboard is prohibited by stating.

Sorry, you are not allowed to access this page.

The login bar also has nearly no options except of going to wordpress.com or logout.

This is probably just a small thing and I just need someone that points me into the right direction.

like image 529
David Avatar asked Sep 11 '16 07:09

David


People also ask

Why can't I get into my WordPress admin?

Common reasons why you can't access wp-admin Your login credentials (username/password) are incorrect. You're being blocked by your security plugin. You changed the WordPress login URL. Your WordPress memory limit is too low.

What is the difference between WP admin and WP-login?

However, they are different: While wp-login (which should be wp-login. php) is a php file in the root folder which returns the form to login into your WordPress, wp-admin is one of the three default folders (wp-admin, wp-content and wp-includes) which contains internal files such as libraries and scripts.


3 Answers

Found the perfect solution for me.

Problem was not with the migrating of the database to the new server but, if in migration prefix is different in old as well as in new database then the issue occurs!

My original database prefix was something like wp_71XXXXXX28_ and in the new installation, I was using wp_. Changing prefix only just solve the data part, but the log in issue still there as you have.

So, I just simply search for the old prefix in all tables using phpmyadmin search option for wp_71XXXXXX28_ and change the records to wp_.

Note: I found 5-6 matches in wp_user and 1 match in wp_option, yours might be different!

like image 182
Sanam Patel Avatar answered Oct 09 '22 06:10

Sanam Patel


this may be because of you change the table name manually then this error show. so also change table prefix into the 'usermeta' table in 'meta_key' column

previousprefixthatyouchangeinnew_ to

  • yourPrefix_capability
  • yourprefix_user_level
  • yourprefix_user-settings
  • yourprefix_user-settings-time

your problem has been solved.

like image 33
Anjani Barnwal Avatar answered Oct 09 '22 06:10

Anjani Barnwal


It sounds like your problem is with the manually created admin account. The error message you're seeing suggests to me that there's an issue with the permissions assigned to the user.

Can you tell me more about the steps you took to manually add the account?

I'm guessing you added the user directly to the users table but after doing so, did you add capabilities and user level information to the usermeta table?

To give you an example, if I'm creating a user I'd run a query to insert the user into the wp_users table (assuming of course we're on the standard table prefix).

I'd then get the ID of my newly created user and use it to insert two new rows into wp_usermeta.

umeta_id should be NULL and user_id should be the ID of your new user for both entries.

1)
meta_key: wp_capabilities
meta_value: a:1:{s:13:"administrator";s:1:"1";}

2)
meta_key: wp_user_level
meta_value: 10

Further reading: http://www.wpbeginner.com/wp-tutorials/how-to-add-an-admin-user-to-the-wordpress-database-via-mysql/

like image 7
Nathan Dawson Avatar answered Oct 09 '22 06:10

Nathan Dawson