Changing WordPress Admin Password
The WordPress admin password can be changed via the WordPress database directly, or via WP-CLI:
====================================================================================
WP-CLI
https://developer.wordpress.org/cli/commands/user/reset-password/
If WP-CLI is installed, the below command can be used to change the admin password:
wp user reset-password
(user has to be specified)
Options
- <user>… - one or more user logins or IDs.
- --skip-email -Don’t send an email notification to the affected user(s).
- --show-password -Show the new password(s).
- --porcelain -Output only the new password(s)
- ------------------------------------------------------------------------------------------------------------------------------------------------
-
Examples;
# Reset the password for two users and send them the change email.$ wp user reset-password admin editorReset password for admin.Reset password for editor.Success: Passwords reset for 2 users.
# Reset the password for one user, displaying only the new password, and not sending the change email.$ wp user reset-password admin --skip-email --porcelainyV6BP*!d70wg
# Reset password for all users.$ wp user reset-password $(wp user list --format=ids)Reset password for adminReset password for editorReset password for subscriberSuccess: Passwords reset for 3 users.
# Reset password for all users with a particular role.$ wp user reset-password $(wp user list --format=ids --role=administrator)Reset password for adminSuccess: Password reset for 1 user.
====================================================================================
MySQL - Editing WordPress Database Directly
use wordpress_database;
UPDATE wp_users SET user_pass = MD5('new_password') WHERE user_login = 'your_admin_username';
====================================================================================
No Comments