Create New Admin Account in WordPress via MySQL

In this tutorial, we can discuss how to create a new admin account in WordPress via MySQL.

1) Login to your cPanel account.

2) Select the icon ‘phpMyAdmin’ under the ‘Databases’ section.

 

3) A new window will open and here you can see the list of databases of your accounts on the left-hand side bar. Then click on the database for your particular WordPress installation.

 

4) After the database details are loaded, you need to click on the tab ‘SQL’.

 

5) After clicking on SQL, a SQL editor will appear. Add the following code to the SQL editor. Here the code creates a new admin account named ‘newadmin’ with the password ‘admin123’. You may change any of the content to fit your requirements.

INSERT INTO `wp_users` (`user_login`, `user_pass`, `user_nicename`, `user_email`, `user_status`) VALUES (‘newadmin’, MD5(‘admin123’), ‘firstname lastname’, ’email@example.com’, ‘0’);

 

INSERT INTO `wp_usermeta` (`umeta_id`, `user_id`, `meta_key`, `meta_value`) VALUES (NULL, (Select max(id) FROM wp_users), ‘wp_capabilities’, ‘a:1:{s:13:”administrator”;s:1:”1″;}’);

 

INSERT INTO `wp_usermeta` (`umeta_id`, `user_id`, `meta_key`, `meta_value`) VALUES (NULL, (Select max(id) FROM wp_users), ‘wp_user_level’, ’10’);

 

6) Then click on the button ‘Go’.

 

This should simply refresh the screen and you should see the message ‘1 row affected’ after each of the three SQL statements. This means the insertion ran smoothly. From here, visit your WordPress admin login and use the new admin login information. You should see admin interface without any issue.

 

If you need any further help please contact our support department.