How to create new Admin user to Magento via PHPmyadmin or MySQL command

0

Sometimes you forget your Magento admin username, password or even registered email for Magento admin user, how do we create another admin user without access to Magento backend?

In this case, Forgot password function of Magento will not work as you forgot admin email, we will need to do something with Magento database.

Related tutorial: How to reset Admin password using phpMyAdmin in Magento

Step 1

Go to your PHPmyadmin tool in hosting cpanel

Next, login to PHPmyadmin with mysql username and password you are using for Magento site, if you forgot this, go to app/etc/local.xml and find these line

In this example, “root” is mysql username and “password” is mysql password. Now use these details to login to PHPmyadmin

Step 2

In phpmyadmin, select the database you are using for your site, in this example: magento

create new admin user magento 1

Select SQL tab and execute the following SQL command

The values you need to replace here are:

  • adminpassword: your desired password, contains at least 1 digit, for example: Magentoexplorer1
  • AdminFirstname: first name
  • AdminLastname: last name
  • admin@email.com: admin email for retrieving password
  • adminusername: your admin username

Now the Sql command should be like this

Put this command to SQL and click on go

create new admin user magento in phpmyadmin

After the query is executed, you will see this result messagecreate new admin user magento in phpmyadmin

This mean you succeeded to add new Magento admin user

Running SQL command via Magento CLI

If you have shell access to your VPS/server, you can use the following command:

Next, execute this command line by line (replace values same as PHPmyadmin)

Step 3

Go to yourmagentosite.com/admin and use the newly created admin account

In this example:

  • Username: brian
  • Password: Magento123456@

Conclusion

There are many handy tips and tricks while working with Magento, if you have any question or suggestion, feel free to let me know at comment section below.

Good Luck!

Rate this post

Share.

About Author

Brian is a Magento developer with 5 years of experience with customizing Magento extensions, Magento templates. He's main author at Magento explorer

Leave A Reply