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 support for spatial data indexing to InnoDB, so the address table will include a spatial-aware location column for MySQL 5.7.5 and higher.

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, provided that the account has privileges to create new databases.

  3. Execute the sakila-schema.sql script to create the database structure, and execute the sakila-data.sql script to populate the database structure, by using the following commands:

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

    Replace the paths to the sakila-schema.sql and sakila-data.sql files with the actual paths on your system.


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

  4. 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 FULL TABLES;
    | Tables_in_sakila           | Table_type |
    | actor                      | BASE TABLE |
    | actor_info                 | VIEW       |
    | address                    | BASE TABLE |
    | category                   | BASE TABLE |
    | city                       | BASE TABLE |
    | country                    | BASE TABLE |
    | customer                   | BASE TABLE |
    | customer_list              | VIEW       |
    | film                       | BASE TABLE |
    | film_actor                 | BASE TABLE |
    | film_category              | BASE TABLE |
    | film_list                  | VIEW       |
    | film_text                  | BASE TABLE |
    | inventory                  | BASE TABLE |
    | language                   | BASE TABLE |
    | nicer_but_slower_film_list | VIEW       |
    | payment                    | BASE TABLE |
    | rental                     | BASE TABLE |
    | sales_by_film_category     | VIEW       |
    | sales_by_store             | VIEW       |
    | staff                      | BASE TABLE |
    | staff_list                 | VIEW       |
    | store                      | BASE TABLE |
    23 rows in set (0.01 sec)
    mysql> SELECT COUNT(*) FROM film;
    | COUNT(*) |
    |     1000 |
    1 row in set (0.00 sec)
    mysql> SELECT COUNT(*) FROM film_text;
    | COUNT(*) |
    |     1000 |
    1 row in set (0.00 sec)