How to Install Sample Data for Magento?

Remember that, Sample Data must be installed prior to the basic Magento Installation. But never mind if you forgot to install sample data before installing Magento.

Here, I will show you how you can install sample data after you have installed Magento.

1) Download Sample Data zip file from Magento Website

2) Extract the zip file

3) Drop all the tables from your magento database. It would be easy to drop the magento database and then recreate it instead of dropping individual tables. This can be done either through Database Manager or PhpMyAdmin.

4) Import sample data sql file into your magento database.

Remember that, you have to drop all tables from your magento database before importing the sample sql file. You will get error afterward if you import the sample data without dropping tables from your magento database. Therefore, step 3 is important.

5) Go to your magento installation folder and delete local.xml file present inside app/etc folder.

6) Reinstall magento (i.e. if you have uploaded magento inside http://yourdomain.com/magento then type the address in your browser’s address bar :))

After your installation is complete, you may get error something like this:

Integrity constraint violation: 1062 Duplicate entry ‘1’ for key 1

Check if app/etc, var, and media folders are writable. They should be writable. Change their CHMOD to 777.

Clear your browser cache or open your website in another browser and you are done :)