• Hi guys,

    how can I change the admin login via mysql cli?

    I already found the command to list all wp-users. For this I use:

    select * from wp_users;

    Unfortunately, the following command doesn’t work for me to change the password:
    UPDATE wp_users SET user_pass=MD5(‘NewPassword’) where id=3;

    Query is OK but the wp-login (website/wp-login.php) doesn’t work.
    How can I change the password?

    Thanks a lot!

Viewing 8 replies - 1 through 8 (of 8 total)
  • Hi, @individuum92

    This article lists seven ways to reset your website’s password. Any one of them will work and do the job.

    Resetting Your Password

    The one describing the MySQL method is this one

    Hope this helps,
    Kind regards!

    • This reply was modified 5 years, 2 months ago by Vlad. Reason: updated link
    Thread Starter individuum92

    (@individuum92)

    Hi @vladytimy

    Thank you very much for your answer. I tried it but it doesn’t work.
    Short summary:

    – select * from wp_users;
    Result: Showed the 3 WP users. So far so good.
    – Placed my password into the hash generator and generated hash
    Result: Hash generated
    – UPDATE wp_users SET user_pass=MD5(‘HERE-MY-HASH’) where id=3;
    Result: Rows matched: 1 Changed: 1 Warnings: 0

    After that, I verified that the user_pass row was be changed: yes.
    Unfortunately, neither the hashed login nor the clear text password login works.

    Any idea?
    Many thanks!

    • This reply was modified 5 years, 2 months ago by individuum92.

    UPDATE wp_users SET user_pass=MD5(‘HERE-MY-HASH’) where id=3;

    Wouldn’t this MD5 an already hashed password? It seems like a double hashing to me.

    Forget the MD5 in the query and use user_pass="HERE-MY-HASH" instead OR don’t hash your password before and use user_pass=MD5('my-plain-text-password')

    Hope this makes sense.

    Thread Starter individuum92

    (@individuum92)

    Both solutions don’t work.
    Needs any service to be restart after passwort changing? I dont think so …?

    WP-Login says that the given password for the user in invalid.

    That’s strange. Is it mandatory to happen via MySQL? The initial article lists many other ways. But I guess you need this for an automatization process. I’ll test the method myself again and let you know if it works for me.

    It works as expected on my tests. By any chance do you have multiple databases for different WordPress sites? You might select a different database? Just thinking what can be wrong.

    Thread Starter individuum92

    (@individuum92)

    I am using the MariDB. But I think thats not the problem here, am I right?
    I have double checked the databases. Everything is fine.

    I have no idea what happen here. I am not sure if it is indeed a WP issue or if I am be the issue ^^

    Thread Starter individuum92

    (@individuum92)

    Any idea here?

Viewing 8 replies - 1 through 8 (of 8 total)

The topic ‘change admin access’ is closed to new replies.