Skip to content

Instantly share code, notes, and snippets.

@meSingh
Created April 5, 2013 20:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save meSingh/5322173 to your computer and use it in GitHub Desktop.
Save meSingh/5322173 to your computer and use it in GitHub Desktop.
Add a admin user in your WordPress database.
-- Step 1 Add the user
-- Change db_wordpress to DB name
-- Change wp_ to your table prefix
-- Change username, pass, nicename, email, url, displayname and pass to your new user info
-- Change date to whenever you want the registered date to be
INSERT INTO `db_wordpress`.`wp_users` (`ID`, `user_login`, `user_pass`, `user_nicename`, `user_email`, `user_url`, `user_registered`, `user_activation_key`, `user_status`, `display_name`) VALUES (NULL, 'username', MD5('pass'), 'nicename', 'email', 'url', '2010-10-08 00:00:00', '', '0', 'displayname');
-- Step 2 Add permissions
-- Find the userid that was just created (int)
-- Replace id with the user id
INSERT INTO `db_wordpress`.`wp_usermeta` (`umeta_id`, `user_id`, `meta_key`, `meta_value`) VALUES (NULL, 'id', 'wp_capabilities', 'a:1:{s:13:"administrator";b:1;}');
INSERT INTO `db_wordpress`.`wp_usermeta` (`umeta_id`, `user_id`, `meta_key`, `meta_value`) VALUES (NULL, 'id', 'wp_user_level', '10');
-- Done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment