• 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’, ‘[email protected]’, ‘https://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’);

Viewing 9 replies - 1 through 9 (of 9 total)
  • 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?

    Thread Starter Gabe462

    (@gabe462)

    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?

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

    Thread Starter Gabe462

    (@gabe462)

    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!

    Do you still have your database backup?

    Thread Starter Gabe462

    (@gabe462)

    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 ??

    Thread Starter Gabe462

    (@gabe462)

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

    Thread Starter Gabe462

    (@gabe462)

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

    Thread Starter Gabe462

    (@gabe462)

    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.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘user created via SQL can't log in to dashboard’ is closed to new replies.