• Home
  • About Us
  • Contact
  • Privacy Policy

LinuxAdmin.io

  • Home
  • Tutorials
    • System Administration
    • Linux Tutorials
    • Web Hosting
    • WordPress
    • Virtualization
    • Troubleshooting
    • OpenStack

Reset a WordPress Password with MySQL

Wordpress Login Screen

This is how to reset a WordPress password through ssh/command line on a Linux server using the MySQL client. This same practice could be executed via PHPMyAdmin or another web based MySQL tool. WordPress stores the passwords in a one-way encryption hash (md5).

To start this process you need to login to the server via ssh or on the console.

WordPress Password Hash Generation

First create a md5 hash of the new password by piping the new password into md5sum:

[user@server]$ echo -n "newpassword"|md5sum
5e9d11a14ad1c8dd77e98ef9b53fd1ba -

Save the output for later.
Alternatively, you can use any number of online md5 hash generators.

If you do not know the database being used, you will need to ssh to the server that needs to have it reset and go to the WordPress install. You can find the database name in the wp-config.php file.

[user@server]$ grep -E 'DB_NAME' wp-config.php
define('DB_NAME', 'wordpress_db');

MySQL Query to Update WordPress Database

Access the MySQL client on the command line and insert the new password for the user, change out the md5 has for the one you selected as well as admin with the username you are updating the password for.

mysql -e "UPDATE wordpress_db.wp_users SET user_pass = '5e9d11a14ad1c8dd77e98ef9b53fd1ba' WHERE user_login = 'admin';"

If this was to be done in PHPMyADmin, you would just update the row of the user in wp_users with the new password hash.

 

Apr 15, 2017LinuxAdmin.io
0 0 votes
Article Rating
Increasing MySQL Max Connections
You Might Also Like
 
FFMpeg Install On CentOS 7
 
Compiling PHP from source on CentOS
Subscribe
Notify of
guest

guest

0 Comments
Inline Feedbacks
View all comments
8 years ago Linux Tutorials, MySQL, Web Hosting, Wordpress 642
Recent Posts
  • Configuring Firewalld to Work Seamlessly with Docker on CentOS
  • Mastering NGINX Tuning: Optimizing Web Server Performance
  • Exploring eBPF: Revolutionizing Network and System Monitoring
  • Kubernetes: Installation and Overview on CentOS 8
  • Install Docker on Centos 8
Most Commented
Hot Clone Linux Server with Rsync
Hot Clone A CentOS Server With Rsync
14 Comments
ngx_cache_purge module
Install The ngx_cache_purge Module In Nginx
8 Comments
piwik-nginx
Piwik Analytics on Nginx
8 Comments
Tags
linuxcentosLinux Performance Tuningsysadminkvmnetworkingmemcachedanalyticssystemd
About

We love Linux and are dedicated to creating Linux administration tutorials for System Administrators since 2016.

Most Viewed
Default Gateway
How To Configure A Default Gateway on CentOS
76,144 views
Zend Opcache
Setup and Optimize Zend OpCache
47,105 views
Install ffmpeg
FFMpeg Install On CentOS 7
21,675 views
Archives
Email subscription

Sign up for our newsletter to receive the latest news and event postings.

2018 © LinuxAdmin.io
wpDiscuz