Add Wordpress admin user to database


/ Published in: MySQL
Save to your folder(s)

When working on client sites, you often need admin access, instead of requiring them to set up an admin user, just make your own. ref:
http://www.dnawebagency.com/how-to-add-an-admin-user-to-the-wordpress-database


Copy this code and paste it in your HTML
  1. -- Step 1 Add the user
  2. -- Change db_wordpress to DB name
  3. -- Change wp_ to your table prefix
  4. -- Change username, pass, nicename, email, url, displayname and pass to your new user info
  5. -- Change date to whenever you want the registered date to be
  6. 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');
  7. -- Step 2 Add permissions
  8. -- Find the userid that was just created (int)
  9. -- Replace id with the user id
  10. 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;}');
  11. INSERT INTO `db_wordpress`.`wp_usermeta` (`umeta_id`, `user_id`, `meta_key`, `meta_value`) VALUES (NULL, 'id', 'wp_user_level', '10');
  12. -- Done

URL: www.owlandfox.com

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.