the MMM blog

How to Add an User to the WordPress via MySQL

How to Add an User to the WordPress via MySQL


First, you should always backup database before performing any MySQL updates.

Using MySQL

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 ('9', 'testaccount', MD5('testaccount'), 'Your Name', 'test@yourdomain.com', 'http://www.test.com/', '2017-01-01 00:00:00', '', '0', 'Your Name');

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

 

Using phpMyAdmin

1. Find the wp_user table or your custom prefix _user table.

2. Click "Insert" on top menu

  • ID – pick a number.
  • user_login – insert the username you want to use to access the WordPress Dashboard.
  • user_pass – add a password for this username. Make sure to select MD5 in the functions menu.
  • user_nicename – put a nickname or something else that you would like to refer yourself as.
  • user_email – add the email you want to associate with this account.
  • user_url – this would be the url to your website.
  • user_registered – select the date/time for when this user is registered.
  • user_status – set this to 0.
  • display_name – put the name you like to display for this user on the site (it can be your user_nicename value as well).
  • Click on the Go Button

3. Find the wp_usermeta table

4. Click the Insert tab just like the previous step. Then add the following information to the insert form:

  • unmeta_id – leave this blank (it will be auto-generated)
  • user_id – this will be the id of the user you created in the previous step. .
  • meta_key – this should be wp_capabilities
  • meta_value – insert this: a:1:{s:13:"administrator";s:1:"1";}

5. Insert another row with the following information:

  • unmeta_id – leave this blank (it will be auto-generated)
  • user_id – this will be the id of the user you created in the previous step. .
  • meta_key – this should be wp_user_level
  • meta_value – 10

 Click on the Go Button.

 

Done! Now you should be able to login WordPress wp-admin by using the username and password you just entered.

 

"If opportunity doesn't knock, build a door"

Contact me!

Have questions? Feel free to use the form or send me an email with any questions.

I will be responsive to your requests and your questions.