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.
Before you run this command, you must Create or update the deployment configuration.
To check the status of the Magento database, enter
1 bin/magento setup:db:status
This command has no arguments or options.
Sample output follows:
1 All modules are up to date.
The command returns one of the following exit codes:
|Exit code||Description||Suggested action|
|1||Some modules use code versions newer or older than the database||Run
|2||setup:upgrade is required||
- 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
- Create or update the deployment configuration
- Enable or disable maintenance mode
- 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