How to add a temporary admin login to WordPress to gain admin access?

Published by: 0

If you have forgotten your WordPress admin password and have exhausted all password reset options. Then this class is for you. It will teach you how to add a temporary admin login so that you are back into the wp-admin backend.

The following instructions are for cPanel. However, it is the same as long as you have phpMyAdmin access

1) Log into your cPanel account. How to login to cPanel

2) Locate the Databases section and select phpMyAdmin

3) Once phpMyAdmin has been loaded, you should now see a list of your databases under your cPanel account.

In this demo, we are using demodomain_dup. Now select that new database by clicking on it.

4) Now on the right hand side, click on SQL

5) Paste the following code into the text box and then click on Go

INSERT INTO `wp_users` (`id`, `user_login`, `user_pass`, `user_nicename`, `user_email`, `user_url`, `user_registered`, `user_activation_key`, `user_status`, `display_name`) VALUES
(‘999’, ‘tempadmin’, ‘$P$BR/nf7eRARUd1x0R3epgsYY3noWSTT0’, ‘tempadmin’, ‘[email protected]’, ”, ‘2017-01-16 14:07:15’, ”, 0, ‘Temp Admin’);

6) If the SQL execution is a success then you should be able to log into your wp-admin backend using the following login credentials

Username: tempadmin

Email[email protected]

Password: tempPASSword123!@#

If the SQL execution wasn’t successful then there are a few possibility.

i) The table prefix is incorrect – To fix this you need to change the SQL query’s ‘wp_users‘ into the appropriate table name. Refer to the phpMyAdmin list of tables on the left hand side. You should see the proper prefix prior to _users is. For example if the prefix is wplc, then update that query to use ‘wplc_users’

ii) The id row has already been used – To fix this, just change the ‘999’ to a higher number. Say ‘2000’, then run the SQL query again.