If you cannot access the WordPress administration panel, you can create a new administrator account directly in the website’s database. This method can be useful when the existing administrator account is unavailable or when access to the WordPress backend has been lost.
Before proceeding, make sure you have access to the website’s database through phpMyAdmin.
Table of Contents
Step 1: Access the Database
Log in to phpMyAdmin from the mybox Panel or by using a direct phpMyAdmin login link.
Use the database credentials assigned to your website during installation.
If you need to reset the database user’s password, update the credentials in the wp-config.php file afterward. Otherwise, WordPress will no longer be able to connect to the database.
Step 2: Open the Users Table
In phpMyAdmin, select your WordPress database from the left-hand menu.
Locate the table ending with _users.
Open the table and note the ID of the most recently created user account. The new administrator account should use the next available ID number.
In the example below, the last user has ID 1, so the new administrator will use ID 2.
Click Insert at the top of the page.
Step 3: Create the New User
Complete the following fields:
| Field | Value |
|---|---|
| ID | Next available ID number |
| user_login | Username used for login |
| user_pass | Password for the new account |
| user_nicename | Display name or author slug |
| user_email | User’s email address |
| user_status | 0 |
| display_name | Name displayed in WordPress |
For the user_pass field, select MD5 from the dropdown menu on the left. This allows WordPress to correctly process the password during the first login.
After completing the fields, click Execute.
Step 4: Grant Administrator Permissions
Open the table ending with _usermeta.
Click Insert.
Enter the following values:
| Field | Value |
| user_id | ID assigned in the previous step |
| meta_key | wp_capabilities |
| meta_value | a:1:{s:13:”administrator”;b:1;} |
Click Execute.
While still in the _usermeta table, click Insert again and enter:
| Field | Value |
| user_id | ID assigned in the previous step |
| meta_key | wp_user_level |
| meta_value | 10 |
Click Execute to save the record.
What to Expect
Once both entries have been added to the _usermeta table, the new account will have administrator privileges.
You should now be able to log in to the WordPress administration panel using the username and password created in the previous steps.
Summary
WordPress stores user accounts and permissions separately in the database. Creating a new record in the _users table and assigning administrator permissions through the _usermeta table allows you to regain access to the WordPress administration panel without modifying existing accounts.