Magento has a sample data archive available that contains sample products and CMS pages to allow you to explore your new Magento installation without having to create everything from scratch. The sample data archive contains a dump of the Magento sample SQL database that should be imported to an empty database using your database management tool (phpMyAdmin or whatever you use) and a ‘media’ folder with sample product images that should be copied to your Magento media folder.
These instructions assume you are in the installation phase with your Magento store and that you have not created your own products and pages. If you already have a working Magento store and database, do NOT install the sample data. Following these steps will wipe out your existing database.
When you're ready to set up your own store, you should re-install Magento without the sample data in order to start clean.
Important note: The sample data must be imported before running the Magento Setup Wizard in the basic Magento installation process. (Among other things the Setup Wizard upgrades the Magento database to the Magento version being installed and the sample data, which is generic, cannot be imported after that conversion takes place.)
Instructions for Installing Sample Data
Follow the overall installation instructions like those provided in the Magento Installation Cheat Sheet. Sample data is optional and if you want to install it, it should be installed at the end of Step 3 in those instructions.
Step 1—Download the sample data
1. Download the sample data archive from MagentoCommerce.com.
Using a browser, download the latest full release archive file from MagentoCommerce.com (http://www.magentocommerce.com/download). The current sample data archive is v18.104.22.168 of the sample data. Don't worry if it's not the same version number as your Magento version number. The sample data is more generic and can be used for multiple Magento versions.
The archive file is about 10MB and is available in .zip, .tar.gz, and .tar.bz2 formats for download (each zipped archive contains exactly the same files and are provided in different formats just for your convenience).
2. Extract the sample data files from the archive.
When done you will have a file called "magento_sample_data_for_22.214.171.124.sql" and a folder called "media".
Step 2—Import the sample data into an empty store database
1. Create a new, empty database for Magento
If you don't already have one, create an empty Magento database using phpMyAdmin or whatever database management tool you prefer
Note: If you already have a database from a previous installation attempt, drop all the tables or drop the magento database and then recreate it. You must drop all tables from your Magento database before importing the sample sql file. You will get error later in the process if you import the sample data without dropping tables from an existing Magento database (that's also why you should not try to import the sample data into a database for a working website).
2. Import the sample data sql file (magento_sample_data_for_126.96.36.199.sql) into your empty Magento database
Use the import function of your database management tool to import the data in the .sql file into your empty database.
Step 3—Set up the sample media
1. Move the sample media folder into the Magento media folder for your installation
If you're using an FTP program, drop the contents of the sample media folder into the media folder for your Magento installation. If you're using the command line, modify the following command to match your directory names:
mv magento-sample-data-188.8.131.52/media/* magento/media/
2. Set the permissions on the media folder to be read and writeable.
If you're using an FTP program, set the permission for the media folder and subfolders to 755. If you're using the command line, you can use the following command:
chmod -R o+w media
Step 4—Continue the normal installation process
Resume the installation process at Step 4 of the Magento Installation Cheat Sheet and run the web-based Setup Wizard. To do so, using a browser, go to your website by domain or IP address (http://www.yourDomain.com/magento or http://yourIP.0.0.1/magento) and the Setup Wizard will run automatically.
Note: If you previously attempted to install Magento, you do not need to download Magento again. Just go to theapp/etc folder and delete the local.xml file and any files and directories in the var/ folder. (The Setup Wizard writes the values you provide during the setup process to the local.xml file and it will not run if it finds alocal.xml file already. The var folder contains cached information and will have cached any previous settings, so deleting this will prevent the incorrect cached content from being used.)
If you get this error:
Integrity constraint violation: 1062 Duplicate entry ‘1′ for key 1
Do the following:
- Check if app/etc, var, and media folders are writeable. If not, change their permissions to 777.
- Clear your browser cache or open your website in another browser