Skip to content

Instantly share code, notes, and snippets.

@wpsmith
Created February 15, 2014 17:18
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 wpsmith/9022194 to your computer and use it in GitHub Desktop.
Save wpsmith/9022194 to your computer and use it in GitHub Desktop.
SQL: Add New Admin User. In the example below, I am using an ID of 2. Change this number to the next user available, or some safe high number.
INSERT INTO databasename.wp_users (ID, user_login, user_pass, user_nicename, user_email, user_url, user_registered, user_activation_key, user_status, display_name) VALUES ('2', 'admin_demo', MD5('demo_password'), 'Travis Smith', 'no-reply@wpsmith.net', 'http://wpsmith.net/', '2014-02-15 00:00:00', '', '0', 'Travis Smith');
INSERT INTO databasename.wp_usermeta (umeta_id, user_id, meta_key, meta_value) VALUES (NULL, '2', 'wp_capabilities', 'a:1:{s:13:"administrator";s:1:"1";}');
INSERT INTO databasename.wp_usermeta (umeta_id, user_id, meta_key, meta_value) VALUES (NULL, '2', 'wp_user_level', '10');
INSERT INTO databasename.myprefix_users (ID, user_login, user_pass, user_nicename, user_email, user_url, user_registered, user_activation_key, user_status, display_name) VALUES ('2', 'admin_demo', MD5('demo_password'), 'Travis Smith', 'no-reply@wpsmith.net', 'http://wpsmith.net/', '2014-02-15 00:00:00', '', '0', 'Travis Smith');
INSERT INTO databasename.myprefix_usermeta (umeta_id, user_id, meta_key, meta_value) VALUES (NULL, '2', 'myprefix_capabilities', 'a:1:{s:13:"administrator";s:1:"1";}');
INSERT INTO databasename.myprefix_usermeta (umeta_id, user_id, meta_key, meta_value) VALUES (NULL, '2', 'myprefix_user_level', '10');
@wpsmith
Copy link
Author

wpsmith commented Feb 15, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment