O'Reilly logo

Learning MySQL by Hugh E. Williams, Saied M.M. Tahaghoghi

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required