Support » Fixing WordPress » WP Security Scan Error after database prefix change

  • Resolved Mizan


    as it is suggested i clicked to chage the database prefix. i did click with a new prefix. but, i double clicked . After that i can’t acces my database or wordpress!
    If i go to admin area it shows error like

    You do not have sufficient permissions to access this page.

    I repeated it in a local server. If someone accidentally double click it happens. or clicks without a different table prefix.

    can anyone explain why it happens ?

Viewing 12 replies - 1 through 12 (of 12 total)
  • Moderator James Huff


    Volunteer Moderator 🚀

    It sounds like your account may have lost admin privileges.

    Access your database via phpMyAdmin (most hosting providers offer this in their control panel), go to the wp_users table and find the row for your user_login . Note the ID of this row. Now, go to the wp_usermeta table and find the wp_capabilities row for your user_id . Set the value of this row to a:1:{s:13:"administrator";b:1;}

    You may also need to check the name of the field <prefix>user_roles in the table <prefix>options. It may have been changed from <oldprefix>user_roles to <newprefix>user_roles.

    Likewise check the values in the field meta_key in the table <prefix>usermeta. <oldprefix>user_level may have been changed to <newprefix>user_level; <oldprefix>utosave_draft_ids may have been changed to <newprefix>utosave_draft_ids.

    Hi, Thanks James and sadra. That i restored from backup.:) Because,i didn’t have the time. But, i was able to reproduce the issue.
    Yah, my prefix_options is also changed. I think i will not restore the database next when it happens again. 😀



    The Security scanner misses changing 4 permissions in the _usermeta table.


    If you run the following SQL query and change PREFIX to your own, it will fix your broken permissions:

    UPDATE 'PREFIX_usermeta' SET 'meta_key' = REPLACE( 'meta_key' , 'wp_', 'PREFIX_' );
    UPDATE 'ea_usermeta' SET 'meta_key' = REPLACE( 'meta_key' , 'wp_', 'ea_' );



    last time i couldn’t solve that way. my knowledge on this issue was limited then. but, i copied from another wordpress installation and that worked fine.
    thanks for the info above.nronksr

    Mizan I have the same problem.
    Unfortunately I haven’t a backup.
    Could you please tell me which files do you replace with the original one?
    Thank you!

    I actually meant database not files. this has been figured out already so credit goes to them.

    Access your database via phpMyAdmin

    if you have only one account your admin ID is 1
    go to newtableprefix_usermeta
    you will see somthing like wp_capabilities for user_id 1 . changed that one to newtableprefix_capabilities.
    then you will get back login. if you wish you can still change all settings as with



    thanks for your suggest, but in this way does not work.
    Ok, I get the new file and unzip it on my document root.
    Now admin section, works but I have a problem with the menu’: when I create a menu, I don’t show it.
    Maybe there is something wrong in the databases related to the menu…

    The problem is your database is wasn’t fully updated with the plugin and the code it ran with the new releases. In order to update them fully you need to also run the SQL statement that follows.

    Do you have access to phpMyAdmin?

    If so, login to phpmyadmin. Click on SQL at the top (should be 2nd tab)

    Now copy/paste the line of code:

    UPDATE ‘PREFIX_usermeta’ SET ‘meta_key’ = REPLACE( ‘meta_key’ , ‘wp_’, ‘PREFIX_’ );

    Change the word PREFIX in the code above to whatever you renamed your table_prefix for your wordpress install. Then click the GO button. This will fix your administrative privileges in the database and thus fix your WP.

    Totally screwed my login, following mentioned suggestions doensn’t work….

    If you give us some more details, perhaps we can try to assist.
    Version of WP your running, perhaps table name prefix change, errors, etc.

    The details of my server:
    Server software: Apache/2.2.11 (Win32) DAV/2 mod_ssl/2.2.11 OpenSSL/0.9.8i PHP/5.2.9
    WP 3.0.4

    But I must say, I used DBC Backup to restore the SQL file. Imported via phpMyAdmin. After reverting the config file to the right wp_ prefix, I was able to gain access again.
    So, your plugin scares the hell out of me!!! Don’t want to be rude, or something, but things like this… well, I couldn’t focus on anything else untill this was fixed…

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘WP Security Scan Error after database prefix change’ is closed to new replies.