Learn how to create an Admin User programmatically in Magento 2. Our Magento Support team is here to help you with your questions and concerns.
How to Create an Admin User via Command Line in Magento 2
According to our experts, creating an admin user in Magento 2 via the command line is an easy process.
Here’s a step-by-step guide to help out:
- First, we have to make sure that we have access to our server. Once logged in, go to the Magento root directory.
- Then, check the available options and usage for creating an admin user by running this command:
php bin/magento admin:user:create –help
This will display the following options:
- Now, it is time to create an admin account with the following information:
- User: johndoe
- Password: J1o7h9n4
- Email:john@gmail.com
- First Name: John
- Last Name: Doe
To create the admin user, run this command:
php bin/magento admin:user:create --admin-user= johndoe --admin-password= J1o7h9n4 --admin-email= john@gmail.com --admin-firstname= John --admin-lastname= Doe
If we run into an error regarding password complexity, we have to make sure the password includes both numeric and alphabetic characters.
For example:
Your password must include both numeric and alphabetic characters. The password should be more complex.
In this case, update the password to something with both numeric and alphabetic characters.
- Now, once we create an admin user we will see a message similar to this:
Created Magento administrator user named johndoe
- Now, go to the Magento admin login page and enter the credentials we just created. We will be able to log in successfully.
[Need assistance with a different issue? Our team is available 24/7.]
Conclusion
In brief, our Support Experts demonstrated how to create an Admin User programmatically in Magento 2.
0 Comments