Remove sample data modules or update sample data

Remove sample data modules or update sample data

This topic discusses how to:

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?

Remove sample data modules

Enter the following command:

1
bin/magento sampledata:remove

The complete list of sample data modules follows:

Magento Open Source and Magento Commerce:

  • magento/module-bundle-sample-data
  • magento/module-catalog-rule-sample-data
  • magento/module-catalog-sample-data
  • magento/module-cms-sample-data
  • magento/module-configurable-sample-data
  • magento/module-customer-sample-data
  • magento/module-downloadable-sample-data
  • magento/module-grouped-product-sample-data
  • magento/module-msrp-sample-data
  • magento/module-offline-shipping-sample-data
  • magento/module-product-links-sample-data
  • magento/module-review-sample-data
  • magento/module-sales-rule-sample-data
  • magento/module-sales-sample-data
  • magento/module-sample-data
  • magento/module-swatches-sample-data
  • magento/module-tax-sample-data
  • magento/module-theme-sample-data
  • magento/module-widget-sample-data
  • magento/module-wishlist-sample-data
  • magento/sample-data
  • magento/sample-data-media

Magento Commerce only:

  • magento/module-customer-balance-sample-data
  • magento/module-gift-card-sample-data
  • magento/module-gift-registry-sample-data
  • magento/module-multiple-wishlist-sample-data
  • magento/module-target-rule-sample-data –>

Prepare to update sample data

This command enables you to update sample data before you update the Magento application.

To prepare sample data for updating, enter the following command:

1
bin/magento sampledata:reset

After that, update the Magento application.