Add new Admin User to WordPress website with PhpMyAdmin

WordPress Admin account is awesome, with the Admin account you can do almost everything in your WordPress site. There are many many ways to create new Admin account to your WordPress site, here are some popular ways:

  • Create new Admin account via PHP.
  • Create new Admin account via WP-CLI.
  • Create new Admin account via phpMyAdmin.

So today i will show you how you can create new Admin account via phpMyAdmin and Mysql syntax.

Create Admin account via phpMyAdmin

phpMyAdmin is a free software tool written in PHP, intended to handle the administration of MySQL over the Web. Currently WordPress using Mysql handle database tasks, so you can using phpMyAdmin to manage your WordPress database, in this case is creating Admin account.

Pros

  • Easy for newbie, who is not have good knowledge about coding and command line.
  • Having good interface.
  • Very intuitive, so you can handle the CRUD (create/read/update/delete) tasks easily.

Cons

  • It will take more times than other ways.
  • Only working on server support phpMyAdmin (for sure).

How

You will need to do 2 main steps:

  • Create new User.
  • Update User role to administrator.

And there are two popular ways in phpMyAdmin help you to do it.

1. Using phpMyAdmin Interface

Create new User

Follow these steps below (all the images below is taken from real-life project Educationlab):

  • First, go to root directory of your WordPress database in phpMyAdmin. Notice that stigan_ is the table prefix in this WordPress site, and all the main details of all users is located in wpusers table.

  • Digging deeper to wpusers table, you will need to create new row on this table, so click in the Insert tab.

  • Insert your new record on this table.
    • user_pass field need to be MD5 (for secure).
    • leave ID field blank, because it will auto increment.
    • Click on Go button whenever you complete.

Boom! New user has been created.

Set this new User to Administrator

You just created new user, the next step is set this new user role to administrator.
WordPress system store all user’s role datas in wpusermeta table, so let’s move on:

  • Digging deeper to wpusermeta table, you will need to create 2 new rows this time, so click on the Insert tab.

  • First, insert new capabilities row like this. Note that:
    • leave umeta_id blank because it will auto increment.
    • user_id must be id of the new user we just created above, see the ID field from wpusers table.
    • meta_value must be written in serialize format, its value is: a:1:{s:13:”administrator”;b:1;} .
    • meta_key must be follow this format: <table_prefix>_wpcapabilities.
    • Click on Go button after fill all the details.

  • Next, insert new user_level row like this. This have simillar notes like capabilities row above

 

Boom! Now your new User account is Admin account in your WordPress site.

 

2. Using MySql Query

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/', '2011-06-07 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');
 
Remember to change the databasename to the database you are working with. Also don’t forget to change the appropriate values.
 

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *

%d bloggers like this: