You are reading the documentation for version 2.2. Magento 2.3 is the latest version available. Ensure you are reading the documentation for your version of Magento.

Check the Magento database status

First steps

  1. 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 Magento file system owner.

    If you use the bash shell, you can use the following syntax to switch to the Magento file system owner and enter the command at the same time:

    1
    
    su <Magento file system owner> -s /bin/bash -c <command>
    

    If the Magento file system owner does not allow logins, you can do the following:

    1
    
    sudo -u <Magento file system owner>  <command>
    
  2. To run Magento commands from any directory, add <magento_root>/bin to your system PATH.

    Because shells have differing syntax, consult a reference like unix.stackexchange.com.

    Sample bash shell for CentOS:

    1
    
    export PATH=$PATH:/var/www/html/magento2/bin
    

    Optionally, you can run the commands in the following ways:

    • cd <magento_root>/bin and run them as ./magento <command name>
    • <magento_root>/bin/magento <command name>
    • <magento_root> is a subdirectory of your web server docroot. Need help locating the docroot?

In addition to the command arguments discussed here, see Common arguments.

Prerequisites

Before you run this command, you must Create or update the deployment configuration.

Command usage

To check the status of the Magento database, enter

1
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
0 Normal None
1 Some modules use code versions newer or older than the database Run magento setup:upgrade to update the database schema and run composer update from the Magento root directory to update component dependencies
2 setup:upgrade is required magento setup:upgrade to update the database schema

Related topics