Sakila Sample Database  /  Installation

4 Installation

The Sakila sample database is available from A downloadable archive is available in compressed tar file or Zip format. The archive contains three files: sakila-schema.sql, sakila-data.sql, and sakila.mwb.


Sakila contains MySQL version specific comments, in that the sakila schema and data depends on the version of your MySQL server. For example, MySQL server 5.7.5 added spatial data, so the address table will include a spatial-aware location column on MySQL server 5.7.5 and above.

The sakila-schema.sql file contains all the CREATE statements required to create the structure of the Sakila database including tables, views, stored procedures, and triggers.

The sakila-data.sql file contains the INSERT statements required to populate the structure created by the sakila-schema.sql file, along with definitions for triggers that must be created after the initial data load.

The sakila.mwb file is a MySQL Workbench data model that you can open within MySQL Workbench to examine the database structure. For more information, see MySQL Workbench.

To install the Sakila sample database, follow these steps:

  1. Extract the installation archive to a temporary location such as C:\temp\ or /tmp/. When you unpack the archive, it creates a directory named sakila-db that contains the sakila-schema.sql and sakila-data.sql files.

  2. Connect to the MySQL server using the mysql command-line client with the following command:

    shell> mysql -u root -p

    Enter your password when prompted. A non-root account can be used as long as the account has privileges to create new databases.

  3. Execute the sakila-schema.sql script to create the database structure by using the following command:

    mysql> SOURCE C:/temp/sakila-db/sakila-schema.sql;

    Replace C:/temp/sakila-db with the path to the sakila-schema.sql file on your system.


    On Windows, use slashes, rather than backslashes, when executing the SOURCE command.

  4. Execute the sakila-data.sql script to populate the database structure with the following command:

    mysql> SOURCE C:/temp/sakila-db/sakila-data.sql;

    Replace C:/temp/sakila-db with the path to the sakila-data.sql file on your system.

  5. Confirm that the sample database is installed correctly. Execute the following statements. You should see output similar to that shown here.

    mysql> USE sakila;
    Database changed
    mysql> SHOW TABLES;
    | Tables_in_sakila           |
    | actor                      |
    | address                    |
    | category                   |
    | city                       |
    | country                    |
    | customer                   |
    | customer_list              |
    | film                       |
    | film_actor                 |
    | film_category              |
    | film_list                  |
    | film_text                  |
    | 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)
    mysql> SELECT COUNT(*) FROM film;
    | COUNT(*) |
    | 1000     |
    1 row in set (0.02 sec)
    mysql> SELECT COUNT(*) FROM film_text;
    | COUNT(*) |
    | 1000     |
    1 row in set (0.00 sec)

Download this Manual
PDF (US Ltr) - 177.1Kb
PDF (A4) - 176.7Kb