Create Admin User via Command Line in Magento 2

In this blog, we will discuss about How to Add Admin User via Command Line(CLI). As you know, from Magento 2, they add many commands in bin/magento. This may difficult to get approach this, let me explain more detail about How to Add Admin User via Command Line(CLI).

How to Create Admin User via Command Line(CLI) in Magento 2?

Open Terminal and go to Magento root folder.

Let create a admin account with the following required information:

  • User: mageclues
  • Password: mageclues123
  • Email: [email protected]
  • First Name: MageClues
  • Last Name: Family
php bin/magento admin:user:create --admin-user=mageclues --admin-password=mageclues123 [email protected] --admin-firstname=MageClues --admin-lastname=Family

And I created successfully a new admin account, it returned message:

Created Magento administrator user named mageclues

If you need to know about admin:user:create command in detail then run below command:

php bin/magento admin:user:create --help


  admin:user:create [options]

      --admin-user=ADMIN-USER                    (Required) Admin user
      --admin-password=ADMIN-PASSWORD            (Required) Admin password
      --admin-email=ADMIN-EMAIL                  (Required) Admin email
      --admin-firstname=ADMIN-FIRSTNAME          (Required) Admin first name
      --admin-lastname=ADMIN-LASTNAME            (Required) Admin last name
      --magento-init-params=MAGENTO-INIT-PARAMS  Add to any command to customize Magento initialization parameters
                                                 For example: "MAGE_MODE=developer&MAGE_DIRS[base][path]=/var/www/[cache][path]=/var/tmp/cache"
  -h, --help                                     Display this help message
  -q, --quiet                                    Do not output any message
  -V, --version                                  Display this application version
      --ansi                                     Force ANSI output
      --no-ansi                                  Disable ANSI output
  -n, --no-interaction                           Do not ask any interactive question
  -v|vv|vvv, --verbose                           Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug

  Creates an administrator

I hope this blog is helpful for you. Please left comment if you have any query.

Thank You.

Related Posts

Leave a Reply

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