WordPress.org

Ready to get started?Download WordPress

Forums

user created via SQL can't log in to dashboard (10 posts)

  1. Gabe462
    Member
    Posted 1 year ago #

    I migrated a WP install to a new server. Somehow the wp_usermeta and wp_users tables disappeared. I re-created the tables, and used the SQL query below to create a new admin user. Now, the user can log in but can't access the dashboard, erroring:

    You do not have sufficient permissions to access this page.

    What do I need to do to give the user access to the dashboard? Why is this admin user restricted?

    INSERT INTOwp_database.wp_users(ID,user_login,user_pass,user_nicename,user_email,user_url,user_registered,user_activation_key,user_status,display_name) VALUES ('1', 'admin', MD5('test'), 'User Name', 'test@usersite.com', 'http://usersite.com', '2011-06-07 00:00:00', '', '0', 'User Name');

    INSERT INTO wp_database.wp_usermeta (umeta_id, user_id, meta_key, meta_value) VALUES (NULL, '1', 'wp_capabilities', 'a:1:{s:13:"administrator";b:1;}');

    INSERT INTO wp_database.wp_usermeta (umeta_id, user_id, meta_key, meta_value) VALUES (NULL, '1', 'wp_user_level', '10');

  2. Andrew Bartel
    Member
    Posted 1 year ago #

    If the database import failed I think you probably want to just redo it. If not, are your tables exactly the same described in this document?

  3. Gabe462
    Member
    Posted 1 year ago #

    I just ran the database repair tool, and it said everything looks good. Would that be sufficient?

    I'll start checking manually too. Are you asking me to check that in each table all the fields are present?

    Is there a tool to test permissions for the file/directory structure?

  4. govpatel
    Member
    Posted 1 year ago #

    check user_meta table admin user normally is 1 and wp_capabilities should be a:1:{s:13:"administrator";s:1:"1";}

  5. Gabe462
    Member
    Posted 1 year ago #

    I have two users, ID 1 & 4. Both started out as a:1:{s:13:"administrator";b:1;}

    I tried changing each to a:1:{s:13:"administrator";s:1:"1";} but that didn't make any difference. Thanks for the try!

  6. Andrew Bartel
    Member
    Posted 1 year ago #

    Do you still have your database backup?

  7. Gabe462
    Member
    Posted 1 year ago #

    I do. This site is being moved from a multisite, and I still have the site on the other server as well.

    I re-exported with Backupbuddy and again, the wp_users & wp_usermeta tables are missing.

    That might not be all :(

  8. Gabe462
    Member
    Posted 1 year ago #

    I moved wp_users & wp_usermeta over manually. It didn't help. There must be something else.

  9. Gabe462
    Member
    Posted 1 year ago #

    Something else I notice is that the site menu in the admin bar is not that of an admin. The only link is Dashboard.

  10. Gabe462
    Member
    Posted 1 year ago #

    I solved it by making a fresh WP install, then exporting the tables from the old site again, manually replacing old to new site details, and then importing over the tables of the fresh install.

    I wish I could understand why it didn't work in the first place. I used a different name for the first user in the fresh install. Perhaps something in the imported tables conflicted with the old user ID #1. Would that make any sense? I could try to break it again by changing the user name.

Topic Closed

This topic has been closed to new replies.

About this Topic