Log in to the Magento server as, or switch to, a user with permissions to write to the Magento file system. See switch to the file system owner.
If you use the bash shell, you can use the following syntax to switch to the file system owner and enter the command at the same time:
su <file system owner> -s /bin/bash -c <command>
If the file system owner does not allow logins, you can do the following:
sudo -u <file system owner> <command>
To run Magento commands from any directory, add
<magento_root>/binto your system
Because shells have differing syntax, consult a reference like unix.stackexchange.com.
Sample bash shell for CentOS:
Optionally, you can run the commands in the following ways:
cd <magento_root>/binand run them as
./magento <command name>
<magento_root>/bin/magento <command name>
<magento_root>is a subdirectory of your web server docroot.
In addition to the command arguments discussed here, see Common arguments.
There are no prerequisites for using this command.
Create or update the Magento deployment configuration
Magento’s deployment configuration provides the information Magento needs to initialize and bootstrap.
You can use this command if:
- You previously installed the Magento software and you want to modify the deployment configuration
- If you want to create only the deployment configuration and continue the Magento installation some other way
- To update the deployment configuration without affecting anything else
1 bin/magento setup:config:set [--<parameter>=<value>, ...]
The following table discusses the meanings of installation parameters and values.
||Uniform Resource Identifier (URI) to access the Admin.
To prevent exploits, we recommend you not use a common word like admin, backend, and so on. The Admin URI can contain alphanumeric values and the underscore character (
||Use any of the following:
- The database server’s fully qualified hostname or IP address.
Note: You can optionally specify the database server port in its hostname like
||Name of the Magento database instance in which you want to install the Magento database tables.
||Username of the Magento database instance owner.
||Magento database instance owner’s password.||No|
||Use only if you’re installing the Magento database tables in a database instance that has Magento tables in it already.
In that case, use a prefix to identify the Magento tables for this installation. Some customers have more than one Magento instance running on a server with all tables in the same database.
The prefix can be a maximum of five characters in length. It must begin with a letter and can include only letters, numbers, and underscore characters.
This option enables those customers to share the database server with more than one Magento installation.
||Use any of the following:
||If you have one, specify a key to encrypt sensitive data in the Magento database. If you don’t have one, Magento generates one for you.||No|
||Advanced MySQL configuration parameter. Uses database initialization statements to run when connecting to the MySQL database.
Consult a reference similar to this one before you set any values.
||Comma-separated list of HTTP cache gateway hosts to which to send purge requests. (For example, Varnish servers.) Use this parameter to specify the host or hosts to purge in the same request. (It doesn’t matter if you have only one host or many hosts.)
Format must be
Import configuration data
When setting up a production system, it’s good practice to import configuration settings from
env.php into the database.
These settings include configuration paths and values, websites, stores, store views, and themes.
After importing websites, stores, store views, and themes, you can create product attributes and apply them to websites, stores, and store views, on the production system.
On the production system, run the following command to import data from the configuration files (
env.php) to the database:
1 bin/magento app:config:import [-n, --no-interaction]
[-n, --no-interaction] flag allows the command to run without additional confirmations.
For additional information, please, check the Import data from configuration files
What is sensitive data?
Magento uses your encryption key to encrypt the following:
- Credit card information
- Usernames and passwords specified in the Admin configuration (for example, logins to payment gateways)
- CAPTCHA values sent over the network
Magento does not encrypt:
- Administrative and customer usernames and passwords (these passwords are hashed)
- Phone number
- Other types of personally identifiable information except for credit card numbers
If applicable, continue your Magento software installation:
- Installing the Magento software using the command line
- Remove sample data modules or update sample data
- Enable or disable modules
- Display or change the Admin URI
- Uninstall modules
- Enable or disable maintenance mode
- Create the Magento database schema
- Update the Magento database schema and data
- Configure the store
- Create or unlock a Magento administrator
- Back up and roll back the file system, media, and database
- Uninstall themes
- Uninstall language packages
- Uninstall the Magento software
- Update the Magento software
- Reinstall the Magento software