Magento 2.0.18 is the final 2.0.x release. After March 2018, Magento 2.0.x will no longer receive security patches, quality fixes, or documentation updates.
To maintain your site's performance, security, and PCI compliance, upgrade to the latest version of Magento.

Update the Magento database schema and data

First steps

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

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

    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:

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

    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?

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

Prerequisites

Before you use this command, you must install the Magento software.

Upgrade the Magento database schema and data

Anytime you perform an action that causes the Magento database schema or data to change, you must update them by running the command discussed in this section. A partial list of reasons follows:

  • You upgraded the Magento software using the command line
  • You installed or updated a component using the command line
  • You enabled or disabled a component using the command line

Note the following:

  • If you used the Web Setup Wizard to do any of the preceding, you don’t have to use the command discussed in this topic.
  • A Magento component can be a module, theme, or language pack; it doesn’t matter whether the component comes from the Magento Marketplace or not

Command usage:

magento setup:upgrade [--keep-generated]

where --keep-generated is an optional argument that does not update static view files. This optional argument is for use only in limited circumstances by experienced system integrators. It should be used only in production mode. It should not be used in developer mode.