How to Add an Admin User to the WordPress Database via phpMyAdmin

Step 1: Login to your CPANEL and then to phpMyAdmin

Step 2: Click on wp_users table and then “Insert”. In the form, add information similar to the screenshot below:

insert-admin

  • ID: pick any number which is not already in use. I have picked 999.
  • user_login: this will be your username to login to the WordPress admin section.
  • user_pass: this will be your password to login to the WordPress admin section. Make sure to select MD5 in the functions menu.
  • user_nicename: this will be your nickname.
  • user_email: this will be your email address.
  • user_url: this will be the URL to your website.
  • user_registered: this will be the date and time you registered the new user.
  • user_status: set this to 0.
  • display_name: this will be the name you like to display for this user on the site.

You can leave the remaining fields empty. Note down your user_id. You will need it for the next step. Make sure you have selected MD5 as a Function for the wp_pass field.

Step 3: Click on wp_usermeta and then “Insert”. In the form, add information below:

usermeta1

  • unmeta_id: leave this empty.
  • user_id: from step 2. I had picked 999.
  • meta_key: set this to wp_capabilities
  • meta_value: set this to a:1:{s:13:”administrator”;s:1:”1″;}

usermeta2

  • unmeta_id: leave this empty.
  • user_id: from step 2. I had picked 999.
  • meta_key: set this to wp_user_level
  • meta_value: set this to 10

And you are done.

Alternately you can run the queries below in the SQL tab

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 ('999', 'admin', MD5('password'), 'Your Name', 'test@yourdomain.com', 'http://www.test.com/', '2015-01-01 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');

Say Hello! Don’t be shy.