• 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:

[[email protected]]$ 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.

[[email protected]]$ 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 vote
Article Rating
Increasing MySQL Max Connections
You Might Also Like
 
Linux Access Control Lists
 
Journalctl Introduction and Examples
Subscribe
Notify of
guest
guest
0 Comments
Inline Feedbacks
View all comments
6 years ago Linux Tutorials, MySQL, Web Hosting, Wordpress 586
Recent Posts
  • Laravel Installation Guide For CentOS
  • Openstack Services Explanation And Overview
  • OSSEC Intrusion Detection Installation On Centos 7
  • Configure ProFTPd for SFTP on CentOS
  • How To Check And Repair MyISAM Tables In MySQL
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
63,000 views
Zend Opcache
Setup and Optimize Zend OpCache
46,714 views
Install ffmpeg
FFMpeg Install On CentOS 7
20,912 views
Archives
Email subscription

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

2018 © LinuxAdmin.io
wpDiscuz