1.9 (37.14%) 7 votes

Part 7: Create admin user

Welcome to our serial articles on Magento 2 Command Lines (CLI)!

You know Magento 2 has provided the powerful command-line interface tool (CLI). It allows you to perform tasks including installation, configuration, database backups, compiling LESS etc. Today I will show you how to create admin use using command line. Before starting this guide, please review our previous posts.

  1. Create new admin user

  • Sometime you change the permission of your administrator account. Then there is no super admin user in your Magento store. You also have no permission to create a new one. What should we do in this situation? You can use the Magento CLI to solve this problem. The command below allows you create a new super admin use in your Magento store.
php bin/magento admin:user:create [–<parameter_name>=<value>, …]
  • The table below shows you parameters and values
Parameter Value Required?
–admin-firstname Magento admin user’s first name Yes
–admin-lastname Magento admin user’s last name Yes
–admin-email Magento admin user’s email address Yes
–admin-user Magento admin user name Yes
–admin-password Magento admin user’s password.

The password must be at least 7 characters in length and must include at least one alphabetic and at least one numeric character.

  • Try to use this command
php bin/magento admin:user:create –admin-fistname=Alex –admin-lastname=Magestore –admin-email=alex@magestore.com –admin-user=admin –admin-password=admin1234@
  1. Unlock an admin user

  • The command below will unlock an admin user
php bin/magento admin:user:unlock {user name}
  • Unlock user ‘admin’
php bin/magento admin:user:unlock admin
  • If success, you got message below
The user account “admin” has been unlocked
  • Otherwise, you got message below
The user account “admin” was not locked or could not be unlocked

Check here for Magento extensions and Magento 2 extensions now !

How to Use all Commands in Magento 2 CLI (Part 5)
How to Add a New Widget in Magento 2