In this tutorial, we will talk about how to Install/Uninstall Sample Data via Command Line . As you know, Magento 2 have many commands in bin/magento folder
. But it may be difficult to get approach with this, so let me explain about it in more detail.
Install / Uninstall Sample Data via command line
Go to Magento root folder and see 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
Uninstall Sample Data Syntax
Go to Magento root folder and see 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]