Skip to main content

How to Create a WordPress Administrator User in phpMyAdmin When You Cannot Sign In

If you are locked out of your WordPress dashboard, you can create a new administrator account by manually inserting a user into the database using phpMyAdmin. This process allows you to regain access to your site when standard login methods fail.

If you are locked out of your WordPress dashboard, you can create a new administrator account by manually inserting a user into the database using phpMyAdmin. This process allows you to regain access to your site when standard login methods fail.

Before you begin

You will need:

  • Access to the Hostek control panel (cPanel or Windows Control Panel)

  • The database name, username, and password for your WordPress database

  • The database host (usually localhost)

  • A chosen username and a strong password for the new administrator account

Creating a new administrator via phpMyAdmin

  1. Log in to your Hostek control panel.

  2. Navigate to the database management tool (e.g., phpMyAdmin in cPanel or phpMyAdmin in Windows Control Panel).

  3. Select your WordPress database from the list on the left.

  4. Locate and click on the wp_users table (Note: your table prefix may differ, such as wp_xyz_users).

  5. Click the SQL tab at the top of the page.

  6. Enter the following SQL command into the text area:

INSERT INTO `wp_users` (`ID`, `user_login`, `user_pass`, `user_nicename`, `user_email`, `user_registered`, `user_capabilities`, `user_status`)
VALUES (Next_ID, 'newadmin', MD5('YourStrongPassword'), 'New Admin', '[email protected]', NOW(), 'a:1:\$E\0$9dc4... (see note)', '0');

Note: Replace newadmin with your desired username, YourStrongPassword with your chosen password, and [email protected] with your email address. If your table prefix is not wp_, ensure the table name in the query matches your actual table name.

  1. Click Go to execute the command.

Assigning the administrator role

Once the user is created, you must grant them administrative privileges.

  1. While still in phpMyAdmin, select the wp_usermeta table.

  2. Click the SQL tab and run the following command to assign the role to the new user:

INSERT INTO `wp_usermeta` (`umeta_id`, `umeta_key`, `umeta_value`)
VALUES (Next_ID, 'wp_capabilities', 'a:1:{s:13:"is_super_admin";b:1;}');INSERT INTO `wp_usermeta` (`umeta_id`, `umeta_key`, `umeta_value`)
VALUES (Next_ID, 'wp_cap', 'a:1:{s:13:"is_super_admin";b:1;});

Note: Replace Next_ID with the unique ID assigned to your new user (usually the highest number in the ID column of the wp_users table).

Confirm the result

  • Log in to your WordPress dashboard at example.com/wp-admin using the new credentials.

  • Verify that you can access the Settings or Plugins menu, confirming your account has administrator privileges.

If you cannot find the correct table prefix

If your database uses a custom prefix (e.g., wp_789_users), the standard wp_ prefix will not work in the SQL command.

  1. Look at the list of tables in the left-hand sidebar of phpMyAdmin.

  2. Identify the table ending in _users.

  3. Update the SQL command to use that specific table name before running it.

Limitations

This procedure requires direct access to the database via phpMyAdmin. If you do not have the database credentials or cannot access phpMyAdmin, you will need to contact Hostek support to investigate your account access.

Did this answer your question?