Skip to content

Instantly share code, notes, and snippets.

@accrane
Created March 15, 2016 19:44
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save accrane/8c67d85659d03432ba97 to your computer and use it in GitHub Desktop.
Save accrane/8c67d85659d03432ba97 to your computer and use it in GitHub Desktop.
Change WordPress User Role to Admin mySql
-- Look at the field called "id" in the result set
--
select * from wp_users
where user_login = 'WORDPRESS_USERNAME_GOES_HERE';
-- Substitute the above "id" value in the "user_id" field below.
-- This is an integer value so do not use quotes around it
-- For example if the above "id" is the value 10 then the resulting line would be: where user_id = 10
--
update wp_usermeta
set meta_value = 'a:1:{s:13:"administrator";s:1:"1";}'
where user_id = USER_ID_GOES_HERE
and meta_key = 'wp_capabilities';
-- Lastly execute this statement remembering to substitute the same "id" value
update wp_usermeta
set meta_value = '10'
where user_id = USER_ID_GOES_HERE
and meta_key = 'wp_user_level';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment