How to retrieve or create a new WordPress admin user in the event of a disaster

How to retrieve or create a new WordPress admin user in the event of a disaster

If you need to recover an administrator user in WordPress or create a new one in case of an emergency, you can do so by following these steps:

 

Access your WordPress site database. You can do this through phpMyAdmin from the cdmon control panel.

 

In your WordPress database, open the "wp_users" table and locate the record of the user you want to recover, or create a new record if necessary. To create a new one, click on “Insert” in the main database menu once you are inside the users table. In the image below, it is highlighted in green:

 

 

Modify the "user_login", "user_email", and "user_pass" fields as needed. If you are creating a new user or recovering access, make sure to set a secure password using a hash function such as md5.

 

Ensure that the "user_status" field has a value of 0 for the user you have just created.

 


Finally, in the "wp_usermeta" table, locate the record associated with the user you have just created or modified and click on “Edit”.

 

Modify the "meta_value" field so that it contains the value: a:1:{s:13:"administrator";s:1:"1";} to grant the user administrator permissions.

 


Save the changes and close the database.

 

After completing these steps, log in to your WordPress site with the recovered or newly created administrator user. If your site is in a critical state, these steps will allow you to regain access and take control in order to resolve the issue. However, we strongly recommend making a backup of your database before performing any modifications.