WordPress: Password forgotten or hacked?! Change password via SQL in 3 steps

Today I had an interesting customer project. When I received the SQL file for the WordPress system from the customer, I found out that I had no access to the system. And my customer is on vacation. So I wanted to log in, but I couldn’t. So this morning I had to create an account for the WordPress system via SQL.

How to reset your WordPress password?

Sometimes you forget your WordPress administration password or need a new one for a customer project. In my case it was the latter. This little tutorial will show you how to change WordPress users and passwords easily. Since I hear about this problem frequently – through searches, friends and customers – I wanted to write a quick post about how you can change your WordPress password in a few seconds, create new users or update your current user account. This little feature even encrypts your password automatically in MD5.

So with just a few clicks and a few inputs you can create or update a new user account within seconds. Let’s get started:

Step 1: Change password via SQL database

All you need is the free PhpMyAdmin SQL database tool. Most providers like one.com or 1und1.de have already integrated the tool into their customer account. If you are working on your notebook (localhost), you will also find PhpMyAdmin preinstalled if you enter http://localhost in your browser. So you can access your database directly. Via SQL command you can easily change the data set.


Step 2: Find and edit wp_users

In PHP my Admin open your database for the WordPress system you want to edit, open the table wp_users (wp_ is the default prefix and can vary)


Step 3: SQL command for password change

Now click on the tab “SQL” in the upper menu. In the tab “SQL” you can enter commands directly. Therefore click on the menu SQL tab. Now enter the following command in the new window:

update wp_users set user_pass=MD5('newpassword123') where user_login='admin'

Now change two variables, first enter your password where it says “newpassword123”, then add the name of the user where it says “admin”. Confirm the entry by clicking on the “Go” button. In a fraction of a second you should receive a message that the table row has been updated. That’s it – you have changed your password, MD5 encrypted and can now log in directly to your system www.url.de/wp-admin.


WordPress Password changed!

Congratulations, this little tutorial has shown you how you can easily change your WordPress password. This will save you a lot of time and phone calls for your customer project, your next blog or your friendly, weekend help campaign. This will save you a lot of time and you can update and change users within WordPress using PhpMyAdmin – whether they know the password or not. All you need is the table wp_users and the simple SQL command update.

[shortcode variables slug=”adsense”]