How to create admin user via Command Line in Magento 2?

If you want to create a new admin user via CLI, You can create a new admin user through CLI by typing the below command.

The admin:user:create command is used to create a new admin user via the command line interface.

This post will help when you are facing login with the admin panel and want to create a new user for admin.

To Run command,

First, navigate to your project root directory in the terminal. You will need to run the following command to create an admin user,

php bin/magento admin:user:create --admin-user='new-admin' --admin-password='admin123' --admin-email='' --admin-firstname='Admin' --admin-lastname='Admin'

Response for the successful new admin user,
Created Magento administrator user named new-admin with green text.

You can replace new-admin and admin123 with your username and password.