Contents
See one of the following sections:
First steps
- Log in to the Magento server as, or switch to, a user who has permissions to write to the Magento file system. One way to do this is to switch to the web server user.
- To run Magento commands from any directory, add
<your Magento install dir>/bin
to your systemPATH
.
Because shells have differing syntax, consult a reference like unix.stackexchange.com.
bash shell example for CentOS:
export PATH=$PATH:/var/www/html/magento2/bin
You can also run the commands in the following ways:
cd <your Magento install dir>/bin
and run them as./magento <command name>
php <your Magento install dir>/bin/magento <command name>
<your Magento install dir>
is a subdirectory of your web server's docroot. Need help locating the docroot? Click here.
In addition to the command arguments discussed here, see Common arguments.
Prerequisites
Before you can use this command, you must do all of the following:
- Create the deployment configuration
- Enable at minimum the Magento_Authorization and Magento_User modules
-
Create the Magento database schema
The simplest way to create the database is to use the command
magento setup:upgrade
.
Create an administrator
Command usage:
magento admin:user:create [--<parameter_name>=<value>, ...]
where the following table defines parameters and values.
Name | Value | Required? |
---|---|---|
--admin-firstname |
Magento administrator user's first name. |
Yes |
--admin-lastname |
Magento administrator user's last name. |
Yes |
--admin-email |
Magento administrator user's e-mail address. |
Yes |
--admin-user |
Magento administrator user name. |
Yes |
--admin-password |
Magento administrator user password. The password must be at least 7 characters in length and must include at least one alphabetic and at least one numeric character. |
Yes |
Related topics
- Installing the Magento software using the command line
- Enable or disable modules
- Uninstall modules
- Create the deployment configuration
- Enable or disable maintenance mode
- Create the Magento database schema
- Configure the store
- Back up the file system, media, and database
- Uninstall themes
- Uninstall language packages
- Uninstall the Magento software
- Update the Magento software
- Reinstall the Magento software