To add an admin user to a Magento 2 site from the command line, SSH to the server and change to the root directory of the Magento 2 install. Then run this command:
1 2 3 4 5 |
php bin/magento admin:user:create --admin-user=jdoe \ --admin-password=mypassword \ --admin-email=jdoe@acme.com \ --admin-firstname=John \ --admin-lastname=Doe |
On a server with Plesk a few notes:
- It’s best to run this command as the user that owns the website subscription.
- You may need to set the path to the correct PHP version with “export PATH=/opt/plesk/php/7.0/bin/php:$PATH”.
- If you get “PHP Fatal error: Allowed memory size of xxxxxxx bytes exhausted” then edit the php.ini file for the correct PHP version and increase the “memory_limit” setting.