Sunday, February 24, 2013

Populate MySQL database with sample data

http://www.generatedata.com, provides a db_install.sql file, which can used for creating sample data tables


1) wget http://www.generatedata.com/files/data_generator2_1.zip

2) unzip data_generator2_1.zip

3) cd data_generator2_1/install

4) Create a database, called "sampledata", from mysql shell
     mysql> create database sampledata;

5) Edit db_install.sql file under data_generator2_1/install/ -
   Add the following line in top of the file db_install.sql
        use sampledata;

6) $ mysql -u root -p < db_install.sql

7) Login to mysql shell
   mysql> use sampledata;
   mysql> show tables;
+--------------------------+
| Tables_in_sampledata     |
+--------------------------+
| dg_cities                |
| dg_counties              |
| dg_countries             |
| dg_first_names           |
| dg_forms                 |
| dg_provinces             |
| dg_provinces_netherlands |
| dg_states                |
| dg_surnames              |
| dg_user_accounts         |
+--------------------------+
10 rows in set (0.00 sec)

No comments:

Post a Comment