Menu Close
    Searching for an experienced Magento 2 Development Company ?

    Create/Edit Magento 2 Admin User Account via CLI

    You can create or edit Magento 2 admin user account using the command line.

    For that, you have to open terminal/command prompt.

    After that go to you’re Magento site’s root directory in the terminal, for example, your Magento site can be in folder/directory path as /var/www/html.
    So go to that directory from command line and after that execute the below command.

    php bin/magento admin:user:create --admin-user='new-user' --admin-password='admin123' --admin-email='[email protected]' --admin-firstname='Admin' --admin-lastname='Admin'

    Once the Magento 2 admin user account is created then you will see the below success message.

    –admin-user-> Admin account username (required).
    –admin-password-> Admin User account password (required).
    –admin-email-> Admin user account’s email address (required).
    –admin-firstname-> Admin user’s first name (required).
    –admin-lastname-> Admin user’s last name (required).

    Note: If you are editing an existing user then only the first name, last name, and password can be edited.

    Hope it will help you. Thank you.

    . . .
    Discuss on Helpdesk

    Leave a Comment

    Your email address will not be published. Required fields are marked*


    4 comments

  • Vimal Kumar Vushakola
    It is showing below error while creating new admin user

    PHP Parse error: syntax error, unexpected ‘?’, expecting variable (T_VARIABLE) in /root/proxy/magento2/magento2/vendor/magento/framework/Filesystem/Directory/Write.php on line 35

    • Anuj Gupta (Moderator)
      Can you please let me know the Magento version in which you are running the above command with PHP version?
  • Syed Muneeb Ul Hasan
    There is one more way to create the admin user in Magento 2 which can be done from its admin panel. I think adding this method will make your tutorial more comprehensive.

    Thanks for sharing this post!

    • Mayur
      >> via CLI <<
  • Back to Top