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
Log in to your Hostek control panel.
Navigate to the database management tool (e.g., phpMyAdmin in cPanel or phpMyAdmin in Windows Control Panel).
Select your WordPress database from the list on the left.
Locate and click on the
wp_userstable (Note: your table prefix may differ, such aswp_xyz_users).Click the SQL tab at the top of the page.
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.
Click Go to execute the command.
Assigning the administrator role
Once the user is created, you must grant them administrative privileges.
While still in phpMyAdmin, select the
wp_usermetatable.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-adminusing 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.
Look at the list of tables in the left-hand sidebar of phpMyAdmin.
Identify the table ending in
_users.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.
