MySQL Installation Sample Database (employee, world, sakila, menagerie, etc.)

Keywords: Database MySQL SQL MariaDB

sakila sample database official information and installation instructions Notice if the supported version of the sample database matches your database.

In order to test, sometimes a large number of data sets are needed. MySQL Official provides a sample database for testing. The download page is in the Here.

Now take the sakila database as an example to show how to install it.

1. Download

In the column of Example Databases on the download page of the official website, you can download the sample database.

Linux system downloads the corresponding tar.gz compressed file, and Windows system downloads zip compressed file.

2. decompression

After decompression, three files are obtained, only two are needed:

  • sakila-schema.sql: database structure file
  • sakila-data.sql: Data file

3. Import MySQL

For Linux:

mysql> source /home/data/sakila-db/sakila-schema.sql;
mysql> source /home/data/sakila-db/sakila-data.sql;

For Windows:

mysql> source C:/Users/Administrator/Downloads/sakila-db/sakila-schema.sql;
mysql> source C:/Users/Administrator/Downloads/sakila-db/sakila-data.sql;

4. test

MariaDB [sakila]> use sakila
Database changed

MariaDB [sakila]> show tables;
+----------------------------+
| Tables_in_sakila           |
+----------------------------+
| actor                      |
| actor_info                 |
| address                    |
| category                   |
| city                       |
| country                    |
| customer                   |
| customer_list              |
| film                       |
| film_actor                 |
| film_category              |
| film_list                  |
| inventory                  |
| language                   |
| nicer_but_slower_film_list |
| payment                    |
| rental                     |
| sales_by_film_category     |
| sales_by_store             |
| staff                      |
| staff_list                 |
| store                      |
+----------------------------+
22 rows in set (0.00 sec)

MariaDB [sakila]> SELECT COUNT(*) FROM city;
+----------+
| COUNT(*) |
+----------+
|      600 |
+----------+
1 row in set (0.00 sec)

Note that if the installed version of the database is lower than the required version of the sample database, some tables and some data may not be inserted.

Posted by congos on Tue, 05 Feb 2019 10:48:15 -0800