Setting Up the world Database  /  Installation

2 Installation

To enable MySQL users to perform manipulation of the world sample database using MySQL, the data set is available as a set of three tables:

  • country: Information about countries of the world.

  • city: Information about some of the cities in those countries.

  • countrylanguage: Languages spoken in each country.

The world.sql file containing the world database is available for download at The file is provided as a compressed tar file or Zip archive.

To install the world sample database, follow these steps:

  1. Download the installation archive to a temporary location such as C:\temp\ or /tmp/ and unpack it. Unpacking the archive results in a directory named world-db containing a single file named world.sql.

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

    $> 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 world.sql script to create the database structure and insert the data using the following command:

    mysql> SOURCE C:/temp/world.sql;

    Replace the path to the world.sql file with the actual path on your system.


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

  4. To confirm that the sample world database is installed correctly, execute the following statements. You should see output similar to that shown here.

    mysql> USE world;
    Database changed
    mysql> SHOW TABLES;
    | Tables_in_world |
    | city            |
    | country         |
    | countrylanguage |
    3 rows in set (0.00 sec)
    mysql> SELECT COUNT(*) FROM city;
    | COUNT(*) |
    | 4079     |
    1 row in set (0.02 sec)
    mysql> SELECT COUNT(*) FROM country;
    | COUNT(*) |
    | 239      |
    1 row in set (0.00 sec)

You now have the world sample database installed.

Another popular sample database is the Sakila database. For additional details, see