May 28, 2016 - No Comments!

How to add a new admin user to WordPress via PHPMyAdmin

First of all this article intends to help all admins who are unable to login to WordPress control panel and aren't able to reset the password using the standard WordPress procedure, and so the only way is to add an admin user via database.

Sometimes you may need to add an admin user to a WordPress site via PHPMyAdmin; this short tutorial could help you accomplish this safely, using only a few queries.

Please note, I suggest you to backup your database as first step, so you could restore it if some problems arise.

Ok, do you save the backup in a safe place? Ok, let's go!

First of all log into your PHPMyAdmin interface, click on "SQL" label (on top right panel) and then copy and paste these lines:

INSERT INTO `YOUR_DATABASE_NAME`.`wp_users` (`ID`, `user_login`, `user_pass`, `user_nicename`, `user_email`, `user_url`, `user_registered`, `user_activation_key`, `user_status`, `display_name`) VALUES ('24', 'demo', MD5('demo'), 'Your Name', '[email protected]', '', '2011-06-07 00:00:00', '', '0', 'Your Name');

INSERT INTO `YOUR_DATABASE_NAME`.`wp_usermeta` (`umeta_id`, `user_id`, `meta_key`, `meta_value`) VALUES (NULL, '24', 'wp_capabilities', 'a:1:{s:13:"administrator";s:1:"1";}');

INSERT INTO `YOUR_DATABASE_NAME`.`wp_usermeta` (`umeta_id`, `user_id`, `meta_key`, `meta_value`) VALUES (NULL, '24', 'wp_user_level', '10');

Remember to replace "YOUR_DATABASE_NAME" with your database name.

Now click on "Go" tu run all the queries pasted.
Ok, it's not over yet, but before you go, what about a share?

Now your WordPress site has a new admin user with these credentials:

Username: demo
Password: demo
Nice name: Your Name
User mail: [email protected] (useful for password recovery)
User site: (this isn't your current WordPress site, but the new author personal site, for example his portfolio or professional profile on a different site)

Now you can login to your Dashboard with the new user and work exactly as the main admin.

It is of the utmost importance to remember to delete the new user account once you enter the site, so no unused account will remain active.

Cheers 🙂

Related Post

Published by: Themelovin in Code
Tags: ,

Leave a Reply