Site icon GetPageSpeed

How to Reset WordPress Password

Wordpress

Wordpress

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"
Exit mobile version