Download and Install the MySQL Sakila Sample Database
Download the official MySQL Sakila ZIP, import its schema and sample data, and verify the database with MySQL queries.
Sakila is MySQL’s sample DVD-rental database. This guide shows where to download the official archive, what its files contain, how to load them into MySQL, and how to verify the installation. Read the official Sakila installation guide for the complete instructions.
Download the Sakila database
Download the official MySQL Sakila sample database ZIP. MySQL also lists the sample archive on its other MySQL manuals and downloads page.
The archive contains two SQL scripts and a MySQL Workbench model:
sakila-schema.sql: Creates the database structure, including tables, views, stored routines, and triggers.sakila-data.sql: Loads the sample data and includes trigger definitions that are applied after the initial data load.sakila.mwb: A MySQL Workbench model for exploring the database structure.
Before you start
Start a MySQL server and use an account that can create databases. A non-root account is sufficient if it has the required privileges.
Install the Sakila sample database
Follow these steps to install Sakila:
-
Unzip the downloaded zip file to a temporary location, for example
C:\temp\or/tmp/. When you unzip the archive, it creates a folder namedsakila-dbthat containssakila-schema.sqlandsakila-data.sqlfiles. -
Use the MySQL command-line client to connect to the server. Replace
db_adminwith an account that can create databases:mysql --user=db_admin --passwordEnter the password when prompted. The password is not included in the command or shell history.
-
At the
mysql>prompt, run both SQL scripts. Update the paths to match where you extracted the archive:SOURCE /tmp/sakila-db/sakila-schema.sql; SOURCE /tmp/sakila-db/sakila-data.sql;On Windows, use forward slashes in the
SOURCEpath, for exampleC:/temp/sakila-db/sakila-schema.sql. -
Verify the installation.
SHOW FULL TABLESshould return 23 rows, and both sample tables below should contain 1,000 rows:USE sakila;OutputDatabase changedSHOW FULL TABLES;Output+----------------------------+------------+ | 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)SELECT COUNT(*) FROM film;Output+----------+ | COUNT(*) | +----------+ | 1000 | +----------+ 1 row in set (0.00 sec)SELECT COUNT(*) FROM film_text;Output+----------+ | COUNT(*) | +----------+ | 1000 | +----------+ 1 row in set (0.00 sec)
Compatibility note
The Sakila scripts use version-specific MySQL comments, so some schema details depend on your server version. For example, the spatial address.location column is included for MySQL 5.7.5 and later. See the official Sakila installation notes and change history.