Reset admin password of WordPress hosted in Azure Linux WebApp

Dear Readers,

I happened to forget my WordPress admin portal Password and was locked out of my blog website. My WordPress website is hosted in Azure WebApp running on Linux.

There are various ways to reset the admin password including followings:

 

  • Using PHPMyadmin: This method didn’t work because it requires PHPMyadmin extension to be installed. This extension is only available for Windows WebApp and not Linux Webapp.
  • Edit Password directly in MySQL Database: I’d to use this option because option 1 wasn’t available for me. This blog article is all about this option and we’ll cover it in details.

     

    In order to proceed with this article you will need following:

Step 1: Download and Install MySQL workbench. MySQL WorkBench is a tool to manage MySQL db instance. You can download it here.

image

Step 2: After you installed MySQL WorkBench you will need to login to Azure Portal and retrieve MySQL connection strings. The connection string will be of following format:

Database=xxxx;Data Source=xxx.mysql.database.azure.com;User [email protected];Password=xxxx

image

Step 3: Now we’ll need to start MySQL WorkBench and supply Data Source as Host name, Username and Password to connect to MySQL.

image

Step 4: Once connection is created and saved, double click the connection to open a connection to MySQL database.

Step 5: Now locate the table called wp_users under the database. Right click the table and select rows and it’ll display the user name. Next click on user_pass column and change the password and click Apply. But wait we need to modify the query so that Password is not stored in clear text rather in MD5 Hash.

Step 6: Convert Plain password in Md5 has and then store it in database. When you click Apply It will pop up with SQL script window. Modify the script to include MD5 function and then click apply.

UPDATE `db`.`wp_users` SET `user_pass`=MD5(‘KloudEzy’) WHERE `ID`=’3′;

image

Step 7: If there were no syntax error it should succeed and you will get the success confirmation.

image

Now you should be able to login with new credentials. Proceed to yourwordpress.com/wp-admin and try to login with the new credentials.

Thank you for taking time to read my article! If you found it useful please let me know by way of comment and share!

Cheers!

Niraj Kumar, MCT & Enterprise Cloud architect.