可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
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.
回答1:
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!
回答2:
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/
回答3:
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.
回答4:
Turns out that this is a bug within Wordpress 4.6.1 when using your own prefix for DB table names.
Rename to wp_ prefix and change the table names and it works.
回答5:
I have also encountered this message after a migration.
Seems like database prefix is case-sensitive, and if it doesn't match exactly, this is what pops up when trying to access administration pages.
Make sure you check your config.php and set it exactly as your table prefix.
If you use phpMyAdmin to check the tables, you should note that all table names in database tree are displayed in lower case, while in my case the expected prefix was all upper cased.
phpMyAdmin image: phpMyAdmin
The right prefix in the image is the one that should be used.
I used "<prefix>_usermeta" table to get the prefix WP expected.
回答6:
For anyone that is still looking for the right answer in my case this what I did to fix the problem of not being able to login to WordPress Dashboard.
In database 'wp_options' table under 'wp_user_roles' option name, all the standard capabilities were missing. Copy those capabilities from database backup or from clean WordPress database.
回答7:
When you use search & replace on the dumped .sql file of the original wordpress site to use it on the new one, ensure you covered all.
I had the same problem and checking the wp_usermeta table, in the meta_key column I discovered some keys named after the old table prefix. Replacing them fixed my problem.