WordPress cannot log on after modifying the database table prefix or has insufficient permissions

Source: Internet
Author: User
Tags phpmyadmin

After re-installing WP, I found that the original user name could not be logged on. I was prompted that the permission was insufficient and I had reached the level. I found a solution. Here I will record it!

The procedure is as follows:

Log on to phpmyadmin-> Select database-> Click SQL and enter the following statement:

UPDATE wp_options SET option_name = REPLACE (option_name, 'WP ', '51php ');
UPDATE wp_usermeta SET meta_key = REPLACE (meta_key, 'WP ', '51php ');

Conclusion: After executing the preceding two SQL statements, you can successfully log on to the Wordpress website background,

Add a detailed process:

Solution: Open the * _ options table, find the column where the optionname field value is * _ user_roles, and change it to the prefix you modified (* indicates the actual prefix ).

Open the * _ usermeta table, and set the value of the old prefix in the meta-key field to OK if the new prefix is changed.

The SQL statement is as follows. After selecting a database in phpMyAdmin, click SQL in the toolbar to execute the following statement:

Update 'new _ usermeta' set 'meta _ key' = replace ('meta _ key', 'old _ ', 'New _') WHERE 'meta _ key' like "% old _ % ";

The above is only an example. You have to modify it based on the prefix of the new and old tables:
Here, "new _" indicates the new prefix after modification. "old" indicates the prefix before modification. After modification, run the command!
 
In fact, the above SQL code is part of the MySql replacement statement. I will not study it together:
For example, replace Welcom to in the the_table table the_subject field with welcome:

Update 'The _ table' set 'The _ subobject' = replace ('The _ subobject', 'Welcome to ', 'Welcome') where instr ('The _ subobject ', 'Welcome to')> 0

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.