How to add a new admin user for WordPress using PHPMyAdmin

This happens to us quite often at WP Expert. A client comes to us to help with their website, is able to to give us access to the hosting, but has no idea about giving us access to the WordPress admin. In this case, we usually go through the database to add a new admin user for WordPress using PHPMyAdmin.

Alternatively, we could just find out what the main admin’s email is through the database and either change it or reset the password, but to add a new admin user for WordPress using PHPMyAdmin has a big advantage, it allows us to create our admin access directly.

1. Add a new admin user using PHPMyAdmin

First step: Open PHPMyAdmin.

Second step: Go to the table wp_users (or yourprefix_users if you used yourprefix as prefix instead of the default one). This table is in the left hand side columns with all the table names.

Third step: Click Insert in the top menu.

Fourth step: Fill in the necessary information

  • ID – Enter an ID that’s not in use yet. Keep this number in mind, you will need it later.
  • user_login – The desired username for your new user.
  • user_pass – The password your new user will login with (the function dropdown’s setting must be MD5 encryption, or it will not work).
  • user_nicename – The name that will be used as slug (your-name).
  • user_email – The email address this user will use, important for login and/or password reset.
  • user_status – This must be set to 0
  • display_name – The name that will be used as display name by your user.

Fifth step: Click on the “Go” button at the right-hand side on the bottom. There should be a green box with confirmation text that appaers in case of success. Otherwise, check if you did anything wrong.

2. Give the right permissions to your new admin user

Once the first part is done, you should give that new user the right permissions in order to make him an admin.

First step: Go to the wp_usermeta table in the left hand side column menu. This table stores the attributes of the users.

Second step: Click Insert in the top menu.

Third step: Enter the following information for your new user:

  • user_id – Enter the ID you used in the first part.
  • meta_key – The meta key must be named wp_capabilities
  • meta_value – Enter this: a:1:{s:13:”administrator”;b:1;}

Fourth step: Click on the button “Go” at the right hand in the bottom.

That’s it! You did it! You added a new user admin through the database on PHPMyAdmin. From now on, you will not be stucked from entering a WordPress install anymore.

Tags: