Loading the Sample Databases

To get a working sample database that you can play with, start by visiting the book’s web site and downloading the music database file music.sql from the sample databases section.

To load the file into your server, you need to use the SOURCE command and specify where MySQL can find the music.sql file. For example, this might be ~/music.sql or ~/Desktop/music.sql on a Linux or Mac OS X system, or C:\Documents and Settings\my_windows_login_name\Desktop\music.sql on a Windows system.

Once you run the SOURCE command, you should see some reassuring messages flash by:

mysql> SOURCE path_to_music.sql_file;
Query OK, 1 row affected (0.00 sec)

Query OK, 1 row affected (0.01 sec)

Query OK, 1 row affected (0.00 sec)
...

You can now see if the database is there by using the SHOW DATABASES command:

mysql> SHOW DATABASES;
+----------+
| Database |
+----------+
| music    |
| mysql    |
| test     |
+----------+
3 rows in set (0.00 sec)

mysql>

We’ll see how to use this database in future chapters.

Repeat this process for the two additional sample database files, flight.sql and university.sql, that are available from the book’s web site. Finally, you can leave the MySQL monitor by typing quit:

mysql> quit

Get Learning MySQL now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.