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.
- Login into your Magento 2 Server with SSH.
ssh your-username-ssh@$server-ip
- Go to the Magento 2 directory e.g.
cd /home/cloudpanel/htdocs/www.domain.com/
- 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='info@domain.com' --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