Skip to content

Instantly share code, notes, and snippets.

@erdnuesse
Last active February 21, 2019 10:26
Show Gist options
  • Save erdnuesse/933a8eb3310a92a50e8ae9538610e591 to your computer and use it in GitHub Desktop.
Save erdnuesse/933a8eb3310a92a50e8ae9538610e591 to your computer and use it in GitHub Desktop.
SQL Statement to quickly re/set the admin password of a wordpress admin to correct_horse_battery_staple (shoutouts to xkcd)
# use this in order to set it quick-and-dirty with the MD5-function
INSERT INTO wp_users (´ID´, ´user_login´, ´user_pass´, ´user_nicename´, ´user_email´, ´user_url´, ´user_registered´, ´user_activation_key´, ´user_status´, ´display_name´) VALUES ('50000', 'admin', MD5('correct_horse_battery_staple'), 'First Last', 'my@gmail.com', 'http://www.example.com/', '2013-01-13 00:00:00', , '0', 'First Last');
Alternative (use this in order to hide the password(s) while doing this - needs testing tho):
INSERT INTO wp_users (´ID´, ´user_login´, ´user_pass´, ´user_nicename´, ´user_email´, ´user_url´, ´user_registered´, ´user_activation_key´, ´user_status´, ´display_name´) VALUES ('50000', 'admin', 'bf08622301b1dc675c6c7e5ada74dbe3', 'First Last', 'my@gmail.com', 'http://www.example.com/', '2013-01-13 00:00:00', , '0', 'First Last');
Use this to MODIFY the existing admin account. - Use with caution
UPDATE `wp_users` SET `user_pass` = MD5( 'correct_horse_battery_staple' ) WHERE `wp_users`.`user_login` = "admin_username";
# alt.
UPDATE `wp_users` SET `user_pass` = bf08622301b1dc675c6c7e5ada74dbe3 WHERE `wp_users`.`user_login` = "admin_username";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment