I am trying to set up a local copy of a production Wordpress blog. On production, I am a user but not an admin, so I am trying to change myself to an admin locally. I was follow
If you have already have your username and password then you just need to update capability and role into database.
Go to wp_user table and locate your ID from there i.e. in my case its 2. And then go to wp_usermeta and look for meta_key = wp_capabilities and user_id - 2. Edit that row and change meta_value to
a:1:{s:13:"administrator";s:1:"1";}.
Again go for meta_key = wp_user_level and user_id = 2. Edit that row and change meta_value to 10. Don't change other rows where user_id is not your own.
See my wp_users table.
See my wp_usermeta table.
Two queries will be fired something like these:
UPDATE `wp_usermeta` SET `meta_value` = '10' WHERE `wp_usermeta`.`umeta_id` =27;
UPDATE `wp_usermeta` SET `meta_value` = 'a:1:{s:13:"administrator";s:1:"1";}' WHERE `wp_usermeta`.`umeta_id` =26;