Support » Fixing WordPress » Cannot sign in to WordPress admin

Viewing 15 replies - 1 through 15 (of 17 total)
  • Jean Werk

    (@brightbluegum)

    Hello

    Does it display any error message at all ?

    When you edited the users tables, are you sure you selected MD5 in the functions list before changing the password ?

    When you disabled all plugins, did you move everything out of the /wp-content/plugins folder ?

    Is there a folder called /wp-content/mu-plugins ? If yes, you could move the content out too.

    Cheers
    Jean

    Jean Werk

    (@brightbluegum)

    And in case you’ve installed WordPress through Installatron (a Cpanel one-click installer), there should be a link to connect to wp-admin.

    Thread Starter ypp

    (@ypp)

    Hi Jean,

    Thanks very much for your reply.

    > Does it display any error message at all ?
    –No error message; just a refresh and return to the login screen

    > When you edited the users tables, are you sure you selected MD5 in the functions list before changing the password ?
    –Yes

    > When you disabled all plugins, did you move everything out of the /wp-content/plugins folder ?
    –No, I just renamed the folder to plugins.disabled

    > Is there a folder called /wp-content/mu-plugins ? If yes, you could move the content out too.
    –No, no folder by that name

    Jean Werk

    (@brightbluegum)

    It looks like there’s a login loop. I’ve experienced this once with a membership plugin but the issue should go away when you rename the plugins folder.

    Was WordPress originally installed from the Cpanel with a one-click installer app like Installatron or Softaculous ?
    If yes, there should be a direct link to wp-admin that doesn’t require authentication.

    Thread Starter ypp

    (@ypp)

    Thanks Jean.

    I don’t know whether WordPress was installed with Installatron or Softaculous. We are borrowing space on another company’s server.

    I will ask your question of the person who manages the server.

    Thread Starter ypp

    (@ypp)

    Hi Jean,

    Confirmed from our server manager that neither Istallatron nor Softaculous were used to install WP.

    Any more ideas?

    Jean Werk

    (@brightbluegum)

    I suppose you’ve tried clearing your browser cache or connecting from another computer ?

    Have you turned on debugging ? Does it capture any error when you log in ?
    https://codex.wordpress.org/Debugging_in_WordPress

    Have you asked your server manager if there’s any error showing in the web server logs ?

    Thread Starter ypp

    (@ypp)

    Hi Jean,

    Thanks again.

    > I suppose you’ve tried clearing your browser cache or connecting from another computer ?
    -Yes. Just tried again from my mobile phone for good measure.

    > Have you turned on debugging ? Does it capture any error when you log in ?
    https://codex.wordpress.org/Debugging_in_WordPress
    -Tried this by following the article. No debug message.

    > Have you asked your server manager if there’s any error showing in the web server logs ?
    -Just asked him, and he relayed the following error message to me:

    [Thu Aug 23 05:39:41.857617 2018] [proxy_fcgi:error] [pid 90131] [client 174.6.144.140:41082] AH01071: Got error ‘PHP message: WordPress database error Duplicate entry ‘0’ for key ‘PRIMARY’ for query INSERT INTO wp_usermeta (user_id, meta_key, meta_value) VALUES (1, ‘session_tokens’, ‘a:1:{s:64:\\”015ca64018e47031fc69c3994052a2163122a4b93ddab68185b7ff70f992f507\\”;a:4:{s:10:\\”expiration\\”;i:1535175581;s:2:\\”ip\\”;s:13:\\”174.6.144.140\\”;s:2:\\”ua\\”;s:68:\\”Mozilla/5.0 (Android 8.0.0; Mobile; rv:61.0) Gecko/61.0 Firefox/61.0\\”;s:5:\\”login\\”;i:1535002781;}}’) 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\n’, referer: http://pendarpagi.org/wp-login.php?redirect_to=http%3A%2F%2Fpendarpagi.org%2Fwp-admin%2F&reauth=1

    Now it looks like we’re getting somewhere. The above matches my mobile phone login.

    On inspection, an existing record in wp_usermeta contained the following properties and values:

    umeta_id 0
    user_id 1
    meta_key wp_statistics
    meta_value a:1:{s:13:”dashboard_set”;s:6:”12.3.5″;}

    The user with user_id = 1 is me as site admin.

    I reassigned the value for umeta_id to 999 and was able to sign in.

    The newly created record in wp_usermeta is as follows:

    umeta_id 0
    user_id 1
    meta_key session_tokens
    meta_value [date from the login just completed, on my laptop]

    What do I do with the record with the previous umeta_id value of 0, now reassigned to 999. Can I safely delete it?

    Is it possible that there are other errors in the database? How would I know?

    Thanks for getting me this far!

    That’s a very interesting issue.
    I wouldn’t delete that record until you find the source of the problem.

    1. Check the structure of the wp_usermeta table.
    There 2 ways of doing this:
    – Structure tab in phpMyAdmin or
    – “describe wp_usermeta;” command in SQL.

    Is umeta_id set to “auto-increment” ?

    2. Check the content of the wp_usermeta table.
    Is the value of umeta_id sequential from 1 to xxxxx (some bigger number) ?
    I wonder if there could be a negative value or some huge number.

    3. Can you try to log in and out a few times ?

    Cheers
    Jean

    Thread Starter ypp

    (@ypp)

    Hi Jean,

    Thanks again.

    1. umeta_id is not set to auto-increment

    2. Yes, values of umeta_id are sequential. Two largest values (other than the row I renumbered manually to 999) are 322 and 407. Presumably the large gap comes from my numerous unsuccessful attempts to add a new administrator before the login loop occurred.

    3. I have been able successfully to log out and in several times.

    Other interesting facts:
    — the renumbered row with a value of “wp_statistics” for the key_name property is a singleton – no other users have a value of “wp_statistics” for that property
    –the new row that was created after my first successful login, with a u_meta value of 0 and value of “session_tokens”, remains in the database after I sign out

    Thread Starter ypp

    (@ypp)

    Correction:

    phpMyAdmin does not show umeta_id in wp_usermeta as being autoincremented.

    The WordPress table description at https://codex.wordpress.org/Database_Description, however, does.

    You’ve found the source of your problem !

    I think that if you add the auto-increment to the umeta_id field, this will correct your problem once and for all.
    I’m not sure how this attribute dropped out but I suppose we’ll never know.

    To set the auto-increment, see instructions here : https://www.inmotionhosting.com/support/community-support/databases/auto-increment-to-database-id-field

    Jean

    Thread Starter ypp

    (@ypp)

    Hi Jean,

    Yes, I think this has got it.

    At first I got an error message when I tried to add the auto-increment attribute to umeta_id; MySQL didn’t like the row with a primary key value of 0 …

    https://stackoverflow.com/questions/5402949/mysql-cant-make-column-auto-increment#6469632

    That was overcome by following the advice in entry #29 of that article, so the resulting code that did it was as follows:

    SET SESSION sql_mode=’NO_AUTO_VALUE_ON_ZERO’;
    ALTER TABLE wp_usermeta CHANGE umeta_id umeta_id BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT;
    SET SESSION sql_mode=”;

    As it turns out (I noted this when I inspected the tables earlier), the ID field for wp_users was also not set to auto-increment, whereas the WordPress spec above says that it should be. So I set that field to auto-increment too.

    At first glance it looks like I have succeeded in adding my user, which was my original mission. We’ll see how that works out but for now it looks promising that we’ve got this one solved.

    Thanks very much for your patient and expert help!

    You’re welcome.
    If you don’t need further help, can you mark this issue as Resolved ?

    Thread Starter ypp

    (@ypp)

    Will do …

Viewing 15 replies - 1 through 15 (of 17 total)
  • The topic ‘Cannot sign in to WordPress admin’ is closed to new replies.