How to reset the WordPress administrator password?

WordPress is the most popular content management system. More than 43% of all websites in the world are built using it. A big problem when working with WordPress is when you forget your login credentials to manage your site. We will show you some ways to quickly recover your WordPress admin password.

Losing your WordPress site administrator password is a situation that can happen to anyone. It often affects webmasters who work on multiple projects at the same time. Learn the methods that will allow you to regain access to the backend of your site if necessary.

“Forgot password” option

If you know your username or the email address assigned to it, the easiest way to recover your password will be to use the Forgot Password? option on the WordPress login page. To do so, follow the steps below:

  • Go to the WordPress login page, generally it is https://www.myanydomain.com/wp-admin, where “www.myanydomain.com” is the name of your domain under which you publish the site
  • Click the link Forgot your password? located below the login and password fields
  • Enter the username or email address associated with your administrator account
  • Click the Get a new password buton
  • Check your email inbox and click the link to reset your password
  • After entering a new and strong password, click Save new password

phpMyAdmin

In a situation where trying to reset your password on the login page doesn’t work, or if you don’t have access to the administrator’s email address, you can establish a new password using phpMyAdmin. This method requires some knowledge, but also caution. Before making the change, we suggest backing up the database you use on your site.
To use the WordPress password change via phpMyAdmin, follow these steps:

  • Log in to phpMyAdmin available at https://mariadb.netart.com
  • Click the + sign next to the database name
  • Search for the wp_users table, then select the Edit buton
  • Find your username under user_login
  • In the user_pass line, select the MD5 function from the drop-down menu
  • In the Value field, enter your new password
  • Confirm the operation by clicking the Execute button

Edit the functions.php file

Another way to reset the password to the WordPress backend is to use the functions.php file. It is located in the folder of the theme you are using, and an example path on an FTP server might look like this:
wp-content/themes/thename_motif
Having your FTP login credentials, follow the steps below:

  • Log in to FTP with an FTP client, such as WinSCP to your server
  • Navigate to the wp-content/themes/name_motif directory
  • Locate the php file
  • Add the code at the beginning of the file: wp_set_password(‘new_password’, 1);
  • Save the changes to the file
  • After correct login, remove the modification you made to the file

WP-CLI

WP-CLI is a tool that allows owners of sites built on CMS WordPress to manage their installations from the command line, without having to log into the site’s backend. The method requires an SSH connection to the server. Once you have done that, follow the steps below:

– Navigate to the WordPress installation directory, for example /wordpress

– To find the target user, type $ wp user list

– Update the wp user update 1 data by replacing the number “1” with the ID of the user for whom you want to make changes

– Update data –user_pass=password, replacing the phrase “password” with the new password

[admin@admin public_html]$ wp user update admin –user_pass=yournewpassword
Success: Updated user 1.
[admin@admin public_html]$

MySQL command line

Resetting the WordPress site administrator password is also possible via the MySQL command line. This is a method for advanced users that requires access to the database via a command-line (SSH) support tool. When opting for this solution, make sure you back up the database before making changes to it. If you want to use this method, follow the steps described below:

  • Obtain the MD5 code of your password, for example through the generator http://www.miraclesalad.com/webtools/md5.php
  • Log into SSH, then log into MySQL using the mysql -u root -p command
  • Select your WordPress database by typing use (name-database)
  • Use the “show tables;” command to find the names of the table with the list of users (you will recognize it by the word “users” at the end of the name)
  • Check the ID, username and password information in the selected table with the SELECT IDuser_login, user_pass FROM (name-database) command
  • Update the username and password by replacing them with the MD5 hash with the UPDATE (name-found-table) SET user_pass=”(hash-MD5-which-you-created)” command. WHERE ID = (id-user-which-you-changed-password);
  • Confirm the changes with the SELECT ID, user_login, user_pass FROM (name-found-table) command;
  • Exit the MySQL client by selecting Ctrl+D on the keyboard

Emergency password reset script

If the above methods didn’t work and you still can’t log into the CMS WordPress backend, try the emergency password reset script. Keep in mind that this is the most advanced method, which, if carried out without proper skills, can lead to serious consequences, including even losing control of the site! Apply it only if you are confident in your knowledge.

  • Copy the emergency script from the Emergency Password Script page and place it via FTP in a file named php in the root directory of your WordPress installation
  • In your browser, open http://www.myanydomain.com/emergency.php, where “www.myanydomain.com” is the name of the domain under which your site is running
  • Enter your administrator name and new password
  • Save the changes
  • If you manage to log in, immediately delete the php file from the server. Without doing this, you run the risk that someone else may use it to change your password

If you use the right tools and methods, regaining access to your WordPress site won’t be that difficult. Of course, before you start the work, make a backup of the database used on the site. This is in case something goes wrong while making changes.

Fast hosting means fast WordPress

Optimal functioning of your WordPress depends largely on the hosting service you use. At netart.com, we offer a dedicated CloudHosting WordPress package. This is cloud hosting specifically optimized for this CMS. It provides sites with the highest performance and uptime. CloudHosting WordPress users get at their disposal a guaranteed power of 4 vCPU and access to 8 GB of RAM. In addition, thanks to CDN netart.com network, sites hosted on CloudHosting load instantly from anywhere in the world.

Don’t wait, enhance your site’s capabilities and order CloudHosting WordPress from netart.com!

Scroll to Top