Add a user to WordPress via MySQL

  1. Open phpmyadmin on the server.
  2. Open the wp_users table
  3. Find the next userId to use
  4. Go to the insert tab
  5.  Fill it in
    1. ID = The next available one found in step 3
    2. user_login = The username you want
    3. user_pass = Set the type to MD5 and input the pw you want
    4. user_nicename = Nickname
    5. user_email = Your email address
    6. user_url = Your site or blank
    7. user_registered = Select the data and time
    8. user_status = Set to 0
    9. display_name = Probably the same as nickname
  6. Hit go
  7. Open the wp_usermeta
  8. Hit insert
  9. Fill the first set of empty cells out like this:
    1. unmeta_id = leave this blank
    2. user_id = Same as the one given to the new user
    3. meta_key = set to “wp_capabilities”
    4. meta_value = set to “a:1:{s:13:"administrator";s:1:"1";}
  10. Fill the second set of empty cells out like this:
    1. unmeta_id = leave blank
    2. user_id = same userId
    3. meta_key = set to “wp_user_level”
    4. meta_value = set to “10”
  11. Hit go
  12. Sign in as the new user

The SQL is this:

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 ('4', 'demo', MD5('demo'), 'Your Name', 'test@yourdomain.com', 'http://www.test.com/', '2011-06-07 00:00:00', '', '0', 'Your Name');

INSERT INTO `databasename`.`wp_usermeta` (`umeta_id`, `user_id`, `meta_key`, `meta_value`) VALUES (NULL, '4', '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, '4', 'wp_user_level', '10');

 

 

Leave a Reply