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.
world.sql file containing the
world database is available for download at
https://dev.mysql.com/doc/index-other.html. The file is
provided as a compressed tar file or Zip
For users of MySQL 5.7 and higher, a
variant also exists that implements features related to
X DevAPI. See Setting Up the world_x Database.
To install the
world sample database, follow
Download the installation archive to a temporary location such as
/tmp/and unpack it. Unpacking the archive results in a single file named
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-
rootaccount can be used, provided that the account has privileges to create new databases.
world.sqlscript 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.sqlfile with the actual path on your system.Note
On Windows, use slashes rather than backslashes when executing the
To confirm that the sample
worlddatabase 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
Another popular sample database is the Sakila database. For additional details, see http://dev.mysql.com/doc/sakila/en/.