Shopping cart

Magento 2 Install / Uninstall Sample Data via Command Line

In this tutorial, we will talk about Install / Uninstall Sample Data via Command Line in Command Line Series. As you know, from Magento 2, they add many commands in bin/magento. This may difficult to get approach this , let me explain more detail about it.

Install / Uninstall Sample Data via command line

Go to Magento admin root folder and show usages:

php bin/magento maintenance:enable

Result:

Usage:
  sampledata:deploy [options]

Options:
      --no-update       Update composer.json without executing composer update
  -h, --help            Display this help message
  -q, --quiet           Do not output any message
  -V, --version         Display this application version
      --ansi            Force ANSI output
      --no-ansi         Disable ANSI output
  -n, --no-interaction  Do not ask any interactive question
  -v|vv|vvv, --verbose  Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug

Help:
  Deploy sample data modules

Install Sample Data Syntax

php bin/magento sampledata:deploy [options]

By default, it will update latest version of sample data via composer, then install it. You can disable it with parameter: --no-update

php bin/magento sampledata:deploy --no-update

Magento asks me enter Username and password like this: ask username

Don’t worry, Go to Access Keys page and Create A New Access Key magento 2 access key

Output:


Uninstall Sample Data Syntax

Go to Magento admin root folder and show usages:

php bin/magento sampledata:remove -h

Output:

Usage:                                                                                                                     
  sampledata:remove [options]                                                                                              
                                                                                                                           
Options:                                                                                                                   
      --no-update       Update composer.json without executing composer update                                             
  -h, --help            Display this help message                                                                          
  -q, --quiet           Do not output any message                                                                          
  -V, --version         Display this application version                                                                   
      --ansi            Force ANSI output                                                                                  
      --no-ansi         Disable ANSI output                                                                                
  -n, --no-interaction  Do not ask any interactive question                                                                
  -v|vv|vvv, --verbose  Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug 
                                                                                                                           
Help:                                                                                                                      
  Remove all sample data packages from composer.json                                                                       

Syntax:

php bin/magento sampledata:remove [options]   




Enjoyed the tutorial? Spread it to your friends!

magento-2-module-development
command
line
cli
console
indexer
reindex

Comments for Magento 2 Install / Uninstall Sample Data via Command Line

Please leave comments if you have any questions, feedbacks.

Module Development

We recommend:

You also may like these Magento 2 Extensions

One Step Checkout

$199
69 reviews

SEO Ultimate

$299
no review