cancel
Showing results for 
Search instead for 
Did you mean: 

I couldn't log in as Admin using the --admin-user and --admin-password parameter's values.

SOLVED

I couldn't log in as Admin using the --admin-user and --admin-password parameter's values.

Hello,

After installing Magento 2, I tried to log in as Admin using the --admin-user and --admin-password parameter's values, but I failed and got the following error messages.

- Error message

The account sign-in was incorrect or your account is disabled temporarily. Please wait and try again later.

 

- Error message of Firefox's development tool 

Content-Security-Policy: This site (http://localhost) has a Report-Only policy without a report-uri directive nor a report-to directive. CSP will not block and cannot report violations of this policy.

 

Regard

 

 

1 ACCEPTED SOLUTION

Accepted Solutions

Re: I couldn't log in as Admin using the --admin-user and --admin-password parameter's values.

Hello

The problem has been resolved after remove semicolon from the beginning of the line ;extension=sodium from php.ini which enables it.

View solution in original post

6 REPLIES 6

Re: I couldn't log in as Admin using the --admin-user and --admin-password parameter's values.

Hi @hossammaghbcbe ,

 

You can try below

 

php bin/magento admin:user:create --admin-user='xyz' --admin-password='xyz@123' --admin-email='xyz@gmail.com' --admin-firstname='Xyz' --admin-lastname='Xyz'

 

As its in your local, you can try random email id to check problem still persist or not.

 

Problem Solved? Accept as solution.

 

Thanks & Regards

 

Ankit Jasani

Re: I couldn't log in as Admin using the --admin-user and --admin-password parameter's values.

Hello @Ankit Jasani 

 

I got the following error when I tried your command and got this error: cache_dir "/srv/http/magento2/var/page_cache" is not writable. So I used sudo to run it, and it ran correctly, and I got a confirmation message: Created Magento administrator user named xyz. But when I tried the new user and password, I got the same error: The account sign-in was incorrect or your account is disabled temporarily. Please wait and try again later.

Please advise.

 

Re: I couldn't log in as Admin using the --admin-user and --admin-password parameter's values.

Hi @hossammaghbcbe ,

 

As setup is in your local system environment, you can try below command once

 

1) Execute below commands from magento root folder

 

sudo php bin/magento setup:upgrade

sudo php bin/magento setup:di:compile

sudo php bin/magento s:s:d -f

sudo chmod 777 -R app/ pub/ generated/ var/

 

Check admin login again, if it's still same issue try 2nd option

 

2)

Find 'Magento_TwoFactorAuth' in app/etc/config.php

Change value from 1 to

Like 'Magento_TwoFactorAuth' => 0,

 

Execute below commands from magento root folder

sudo php bin/magento setup:upgrade

sudo php bin/magento setup:di:compile

sudo php bin/magento s:s:d -f

sudo chmod 777 -R app/ pub/ generated/ var/

 

Check admin login again, if it's still same issue try 3rd option

 

3) core_config_data table make entry like below

localhost-8084-mlsmariadb-magento247-sample-core_config_data-phpMyAdmin-5-2-0-05-02-2025_03_08_PM.png

sudo php bin/magento setup:upgrade

sudo php bin/magento setup:di:compile

sudo php bin/magento s:s:d -f

sudo chmod 777 -R app/ pub/ generated/ var/

 

Check again problem solved or not.

Also check var/log/system.log & var/log/exception.log

 

Note: In case above not worked,you can try below as well.

 

Currently you are running with localhost, ideally I suggest to run with domain like http://test.magento.test

and add one more entry in core_config_data table

default | 0 | web/cookie/cookie_domain | .magento.test

 

sudo php bin/magento setup:upgrade

sudo php bin/magento setup:di:compile

sudo php bin/magento s:s:d -f

sudo chmod 777 -R app/ pub/ generated/ var/

 

Ankit Jasani

Re: I couldn't log in as Admin using the --admin-user and --admin-password parameter's values.

The four solutions are not working. Please advise

Also, If my keyboard language isn't en_US, can the change cause this problem?

 

Regards

 

 

Re: I couldn't log in as Admin using the --admin-user and --admin-password parameter's values.

When you see “The account sign-in was incorrect or your account is disabled temporarily,” it usually means either the account really isn’t what you think it is, or Magento has locked it after too many failed attempts. Here’s a quick checklist to get you back in:

  1. Verify the Admin User Exists
    Run:

     
    php bin/magento admin:user:list

    Make sure the username shown here exactly matches the one you passed to --admin-user. Typos or case differences will fail.

  2. Reset the Admin Password
    If you can’t remember the exact password you set (or want to be sure), reset it with:

     
    php bin/magento admin:user:change-password \ --username=your_admin_username \ --password="YourNewP@ssw0rd"
  3. Unlock the Account
    Magento locks out an admin after a few failed logins. Clear that lock with:

     
    php bin/magento admin:user:unlock your_admin_username
  4. Clear Cache, Sessions & Cookies

    • Flush Magento caches:

       
      php bin/magento cache:flush
    • Delete var/session (or var/session/*) and var/page_cache/*

    • In your browser, fully clear cookies for localhost or whichever domain you’re using.

  5. Check Your Base URL & Cookie Settings
    If you’re on http://localhost:8080/ but your Base URL in Stores → Configuration → Web is set to http://localhost/, cookies won’t match and the login will silently fail. Make sure your Base URL and Cookie Domain exactly match your testing URL.

  6. Disable Any Report-Only CSP Temporary
    The Firefox CSP warning is harmless—Report-Only mode doesn’t block anything—so you can ignore it for now. It isn’t why your login is failing.

Once you’ve reset the password, unlocked the account, cleared caches and cookies, and confirmed your Base URL/cookie settings, you should be able to log in with the new credentials immediately. If it still fails, double-check your env.php for the correct table prefixes or look in the admin_user table directly to confirm your changes took effect.

I also faced the same issue with this site but then I wan able to get it back on track.

 
 
 
 

Re: I couldn't log in as Admin using the --admin-user and --admin-password parameter's values.

Hello

The problem has been resolved after remove semicolon from the beginning of the line ;extension=sodium from php.ini which enables it.