Web Apps / Wordpress

How to Reset WordPress Password

by ,


We have by far the largest RPM repository with NGINX module packages and VMODs for Varnish. If you want to install NGINX, Varnish, and lots of useful performance/security software with smooth yum upgrades for production use, this is the repository for you.
Active subscription is required.

It happens that we forget passwords. If you have lost your WordPress password, there are several ways you can reset it.

Reset using MySQL

First, let’s create temporary administrator account.

Access PhpMyAdmin or command line MySQL terminal. Then run the following queries directly. Be sure to replace admin2, password and user@example.com with values of your own:

INSERT INTO `wp_users` (`user_login`, `user_pass`, `user_nicename`, `user_email`, `user_status`) VALUES ('admin2', MD5('password'), 'Temporary admin', 'user@example.com', '0');

INSERT INTO `wp_usermeta` (`umeta_id`, `user_id`, `meta_key`, `meta_value`) VALUES (NULL, (Select max(id) FROM wp_users), 'wp_capabilities', 'a:1:{s:13:"administrator";s:1:"1";}');

INSERT INTO `wp_usermeta` (`umeta_id`, `user_id`, `meta_key`, `meta_value`) VALUES (NULL, (Select max(id) FROM wp_users), 'wp_user_level', '10');

Make sure to use something complex for password!
Now you can login to WordPress admin using this temporary account. It’s easy to change your primary account using WordPress interface.

Reset WordPress password using WP-CLI

WP-Cli is a great command line tool for WordPress. You can easily reset your WordPress user password using WP-Cli:

wp user update admin --user_pass="PASSWORD"

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: