Viewing 5 replies - 1 through 5 (of 5 total)
  • If you are able to log in with Editor account and not with Administrator account, and you checked in other browser, then there is strong possibility that you are providing wrong password.

    Following are the steps to reset password via PhpMyAdmin:
    1. Go to wp_users table.
    2. Edit the required Administrator account(might be with user id = 1)
    3. In ‘user_pass’ field select function as ‘MD5’ and in value section type your password e.g. 12345678.
    4. Click go.

    Now try to log in via administrator account.

    Please check this for reference.

    • This reply was modified 1 year, 7 months ago by emahajan.
    Thread Starter station7

    (@station7)

    Thank you so much for your reply!
    Unfortunately it didn’t work 🙁
    I reset the password by following your instructions (several times) and get the same result – the login screen just reloads, with no error. When I try to type the wp-admin URL manually (just in case it wasn’t forwarding me) I get redirected back to the login page. So I definitely don’t get logged in.

    When I type a wrong password, or reset the password in the DB using a function other than MD5, I see an error: “Error: The password you entered for the username (actual username) is incorrect. Lost your password?”

    But when I type the correct password, I don’t get the error – I just don’t get logged in. I’m not sure what could be wrong.

    Edit: I’m not sure if this is normal, but when I set the password in the database using MD5, and click Go, it changes to something like “d534b96c9c131039a98126891ec878eb” but when I refresh the table after a login attempt, it changes again to something like “$P$BWD6EkI8RbwdJ63xZNEK93WetWcHZz1” (actual values changed for safety). Why does it change itself after a login attempt? Is this expected?

    • This reply was modified 1 year, 7 months ago by station7. Reason: add information
    • This reply was modified 1 year, 7 months ago by station7.

    It’s strange, please enable the debug mode from wp config file and check for errors.

    If the password value is changing after login attempt then it’s not normal.

    Just copy the editor’s account password value and update same at your admin’s password value and then check.

    Thread Starter station7

    (@station7)

    When I copy and paste the editor’s password in the DB, I get the same result – it doesn’t work. Just reloads the login page with no errors.

    I enabled debugging and in the debug.log I see this error:

    [29-Aug-2022 13:08:24 UTC] WordPress database error Duplicate entry '0' for key 'PRIMARY' for query INSERT INTOwp_usermeta(user_id,meta_key,meta_value) VALUES (1, 'session_tokens', 'a:1:{s:64:\"1647d8bccea0994d27df45e4813d8ba39286fcb4c357587de16cf4e6df2305e0\";a:4:{s:10:\"expiration\";i:1661951304;s:2:\"ip\";s:13:\"138.58.198.149\";s:2:\"ua\";s:70:\"Mozilla/5.0 (X11; Linux x86_64; rv:104.0) Gecko/20100101 Firefox/104.0\";s:5:\"login\";i:1661778504;}}') made by wp_signon, wp_set_auth_cookie, WP_Session_Tokens->create, WP_Session_Tokens->update, WP_User_Meta_Session_Tokens->update_session, WP_User_Meta_Session_Tokens->update_sessions, update_user_meta, update_metadata, add_metadata

    So seems like something wrong with the database?

    Edit: there is a row in the wp_usermeta table that has a umeta_id of 0 and a “session_tokens” value for “meta_key”, but the user_id field for that row is 2. So the error is correct, there is already a row with ID of 0. But shouldn’t it get a non-zero ID automatically?

    • This reply was modified 1 year, 7 months ago by station7.
    Thread Starter station7

    (@station7)

    Turns out the problem was that the database primary key field in the wp_usermeta table was not set to auto-increment. (Probably this happened during a database migration back in January, though I was able to log in after this, or maybe a WP update)

    This is how I fixed it:

    https://stackoverflow.com/questions/18688694/error-duplicate-entry-0-for-key-primary/33686734#33686734

    https://stackoverflow.com/questions/19434801/how-to-add-auto-increment-to-column-in-mysql-database-using-phpmyadmin/33686718#33686718

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Unable to log in as administrator’ is closed to new replies.