1

I have a wordpress site (6.2.2). I forget my admin password. The site is not setup with SMTP yet, so the forget password link won't work.

I tried several ways, but none of them works.

1. WP CLI - No luck

  • Install WP CLI, go to wordpress site folder, 'wp user list' to see all users so I can have my id, then run

wp user update 1 --user_pass=my_clear_password

successfully -> then try to login into the WP admin using 'my_clear_password', but the login failed.

2. Add reset password function call to functions.php: No luck

wp_set_password( 'my_clear_password', 1 );

3. use WP CLI to disable Wordfence, then login again -> No luck

4. Use SQL Update: No luck

UPDATE wp_users SET user_pass=MD5('my_clear_password') WHERE ID=1;

5. My environments:

Ubuntu 22, Wordpress 6.22, MySQL 8, PHP 8.

I am thinking something blocked the logins. Any comments? Thanks!

4
  • 1
    Your SQL update used 12 instead of 1; is that a typo? (Also, when resetting with MySQL, use an MD5 hash instead of a cleartext password; see the documentation here.)
    – Pat J
    Commented Oct 6, 2023 at 22:32
  • 1
    disable all your plugins, not just wordfence, then reset using WP-CLI and then try to login. Why would your password just simply not work on a normal, standard WordPress site with no plugins active? It's just not going to happen, so you probably have a plugin that's interferring. Also, use the WP-CLI reset password command: developer.wordpress.org/cli/commands/user/reset-password
    – Paul G.
    Commented Oct 7, 2023 at 13:06
  • @PatJ: sorry it must be 1.yes typo. I also used MD5 mysql function. Please see the updated post.
    – LHA
    Commented Oct 7, 2023 at 23:42
  • @PaulG: will try it next week. Thanks!
    – LHA
    Commented Oct 7, 2023 at 23:43

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.