How to create admin user using command line in magento 2?

Some times we need to create admin users without login to magento admin panel.We can use command line to create an admin users.This is some thing pretty simple to achieve.

Run the below command from the root directory.

bin/magento admin:user:create

You will get the prompt to give Admin user, Admin Password, Admin Email, Admin first Name, Admin Last Name one by one respectively after fill each.Once everything filled successfully you will get the the success message of ” Created Magento administrator user named username “.

create admin using Command line
create admin using Command line

After cache flush you can use the created credential to log in to admin panel.

Leave a Reply

Your email address will not be published. Required fields are marked *