Magento is one of the most popular eCommerce solutions in the market. Built as an open-source ecommerce platform, Magento supports merchants to customize the website flexibly to meet their business requirements. The platform offers sample data to test the store performance and scalability, thus allowing store owners to bring a great experience for their customers.
What is Magento 2 sample data?

For store admins, Magento 2 sample data provides online store owners with a storefront based on the Luma theme outfitted with products, categories, customer registration, and so on. It functions just like a Magento storefront and you can manipulate prices, inventory, and promotional pricing rules using the Magento Admin.
For developers, sample data is a set of common Magento modules, which can be deployed and installed together with the Magento instance, or later in the scope of upgrade. That is the reason why installing sample data is optional.
Why we need Magento 2 Sample Data?
There are 3 crucial factors that an online store owner must consider before opting for any eCommerce platform. These factors include performance, user experience, and scalability. The sample data is very important when you need a tool to conduct the store’s performance and scalability tests easily.
Specifically, Magento 2 sample data offers the admin store to add nearly 250 sample products and categorize them into various groups. The number of sample products in stock is enough for the admin to test the website performance. Thus, instead of integrating modules, which helps optimize the shopping experience, they can modify their website in advance.
How to install Magento 2 sample data?
Let’s learn to install Magento sample data.
1. Launch SSH terminal to connect your Magento website
2. Move to the root directory (public_html) of your website

3. Run the following CLI content to install Magento 2 sample data.
php bin/magento sampledata:deploy

4. To authenticate from repo.magento.com, type your username, and password.

5. Log in to your Magento marketplace account and click My Profile

6. Click Access Keys in My Products section

If you already have an access key, you can use that. Otherwise, you need to generate a new key: Create A New Access Key.

There are two types of keys: a public and a private one.
- Public Key: Use this public key as your username.
- Private: Use this private key as your password.
7. Move back to the SSH terminal and type your username, password and Type ‘Y’:

8. Enter to start the Magento 2 sample data installation process.

9. After installing Magento 2 sample data, run the following commands one by one.
php bin/magento setup:upgrade
php bin/magento setup:di:compile
php bin/magento setup:static-content:deploy -f
10. Move to your store’s front page.

After that, you can go to the frontend to see if the sample works
How to remove sample data modules?
There is currently no way to uninstall sample data. So we will guide you on how to remove sample data modules from the Magento installation composer.json
. However, this way does not remove sample data from the database.
1.Log in to the Magento server as a user with permission to type to the Magento file system. If the Magento file system does not allow admin to log in, you can do the following:
sudo -u <Magento file system owner> <command>
2. Add <magento_root>/bin
to your system PATH, to run Magento commands from any directory. Sample bash shell for CentOS:
export PATH=$PATH:/var/www/html/magento2/bin
3. Optionally, the commands can be run in the below ways:
<magento_root>
is a subdirectory of your web server docroot.cd <magento_root>/bin
and run them as./magento <command name>
<magento_root>/bin/magento <command name>
4. Follow the command line:
bin/magento sampledata:remove
How to update sample data?
This command helps you to update sample data before you update the Magento application. To prepare sample data for updating, add the following command:
bin/magento sampledata:reset
After that, update the Magento application via composer.
That was all about Magento 2 sample data installation. Once you have installed sample data on Magento 2 website, you can test the function with the test data as much as you want. Hope you guys can complete this tutorial without any difficulty.
Besides, if you are looking out for a cost effective Magento package for your eCommerce store, then look nowhere other than Magesolution. We not only offer an affordable Magento Development Package for all size and budget but also ensure that it helps your online business grow and sustain. Contact us for a free consultation!