Overview:
This guide walks you through the steps to create a new admin user for your Magento 2 store using the command line. This method is particularly useful if you’re unable to access the admin panel or need to quickly add a user without navigating through the UI.
Step 1: Access Your Server via SSH
Log in to your server using SSH. This is typically done with a command like ssh username@server_ip_address.
Step 2: Navigate to the Magento 2 Root Directory
Once logged in, navigate to the root directory of your Magento 2 installation. This is the folder where Magento 2 is installed, typically something like /var/www/html/magento2.
cd /path/to/magento2
Step 3: Run the Command to Create an Admin User
Run the following command, replacing the placeholders with your desired username, password, email, first name, and last name:
php bin/magento admin:user:create --admin-user="newadmin" --admin-password="password123" --admin-email="email@example.com" --admin-firstname="Admin" --admin-lastname="User"
Breakdown of the command:
--admin-user: The username for the new admin user.
--admin-password: The password for the new admin user. Ensure that it meets Magento’s password complexity requirements.
--admin-email: The email address associated with the admin user.
--admin-firstname: The first name of the admin user.
--admin-lastname: The last name of the admin user.
Step 4: Verify the User Creation
After running the command, you should see a confirmation message in the terminal that the admin user has been created. You can now log in to the Magento admin panel using the new credentials.
Additional Notes:
Ensure that you have the necessary permissions to execute the bin/magento command.
If you encounter any issues, check the command for typos and ensure that your Magento installation is functioning properly.
By following these steps, you can create a new admin user for your Magento 2 store directly from the command line, providing you with a quick and efficient way to manage admin access.
Comments
0 comments
Please sign in to leave a comment.