You can create a new WordPress admin user from within the database using phpMyAdmin.
Method 1
1.) Log into phpMyAdmin (cPanel / Plesk / Web Hosting / Managed WordPress).
Note: If you’re using cPanel Hosting, you must select the database for your WordPress site in the left-hand column before proceeding to the next step
2.) Click the _users table
3.) Click the Insert tab
4.) Fill in the following fields.
- ID is any number you choose
- user_login is the username for accessing the WordPress Dashboard.
- user_pass is the password for the user. Make sure to select MD5 in the functions menu
- user_nicename is the nickname for the user
- user_email is the email address you want to associate with this user
- user_registered is the date and time for when this user is registered
- user_status should be set to 0
- display_name is the name that will be displayed for this user on your site
5.) Click the Go button
6.) Click the _usermeta table
7.) Click the Insert tab
8.) Fill in the following fields:
- user_id is the ID you entered in the previous step
- meta_key should be the phrase wp_capabilities
- meta_value should be
Note: If your database table prefix isn’t the standard wp_ prefix, i.e. newprefix123_ the meta_key would become newprefix123_capabilities
a:1:{s:13:"administrator";s:1:"1";}
9.) Click Go
10.) Click the Insert tab again
11.) Enter the following information:
- user_id is the same number you entered in the previous step
- meta_key should be the phrase wp_user_level
- meta_value should be the number 10
12.) Click the Go button.
You can now login with the new Admin user.
Method 2
For developers who want to speed this process up, you can simply drop this SQL query in your database:-
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/', '', '', '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');
Remember to change the databasename to the database you are working with. Also don’t forget to change the appropriate values.