How to create a new Magento 2 administrator account

How to create a new Magento 2 administrator account

This tutorial shows you how to create or reset a Magento 2 administrator account. This could be helpful if you have lost the Magento 2 admin credentials or you need to create a new one.

For creating a new administrator account for Magento 2, we use the Magento CLI.

  1. Login into your Magento 2 Server with SSH.
ssh your-username-ssh@$server-ip
  1. Go to the Magento 2 directory e.g.
cd /home/cloudpanel/htdocs/
  1. Use the below command to create a new administrator with the username new-admin and password !admin123!
php7.4 bin/magento admin:user:create --admin-user='new-admin' --admin-password='!admin123!' --admin-email='' --admin-firstname='John' --admin-lastname='Doe'

Once the new Magento 2 administrator account has been created, you will see the following success message:

Created Magento administrator user named new-admin.

Parameter explanation

Name Value
--admin-user (Required) Admin user
--admin-password (Required) Admin password
--admin-email (Required) Admin email
--admin-firstname (Required) Admin first name
--admin-lastname (Required) Admin last name

To see all available options, you can execute the following command:

php7.4 bin/magento admin:user:create --help

Magento 2 Administrator account parameters

Shraddha S.
Shraddha S.
Head of Content

Shraddha Singh has a lot of thoughts about Technology and the Cloud Services Industry. An Indian native and a professional Technical writer, she gets her management skills from IIT-B.

Get the fastest Magento Hosting! Get Started