Create an Administrator User
Looking how to create an Administrator User in Magento 2, but not from the Magento Admin area? Magento 2 has implemented a CLI command for that. Let's check it out!
As is well known, Magento 2 provides Command Line Interface (CLI) which is really useful giving us the ability to perform a lot of tasks. One of these tasks is to create an administrator user. To have a look to all available CLI commands you can easily type the following command in your terminal from the Magento 2 root directory
if you executed the above command you could see that in the list there is also a command for implementing admin user creation. So to create an administator user just execute the following command
php bin/magento admin:user:create --admin-user="admin" --admin-firstname="Admin" --admin-lastname="Admin" --admin-email="firstname.lastname@example.org" --admin-password="admin123"
Having a look on the parameters
--admin-firstname Magento administrator user's first name
--admin-lastname Magento administrator user's last name
--admin-email Magento administrator user's e-mail
--admin-user Magento administrator user name
--admin-password Magento administrator user password
Having a look to all available parameters you can execute the following command
php bin/magento admin:user:create --help
You can also use the above command to update an admin user. If you’re updating an administrator, only the first name, last name, and password can be updated.
Feel free to share this post and ask your questions in the comments below.
Till next time!