To enable MySQL users to perform manipulation of this data set using MySQL, the data set is available as a set of three tables:
For MySQL 5.7+ users, a
world_x variant also
exists that implements 5.7+ specific features related to the X
DevAPI. That version is also available at
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 file is available for download at https://dev.mysql.com/doc/index-other.html.
Releases issued prior to September 2016 used table names in mixed cases. Now table names are all lowercase. This is because MySQL Shell is case-sensitive.
To install the
world sample database, follow
Extract the installation archive to a temporary location such as
/tmp/. 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 as long as the account has privileges to create new databases.
world.sqlscript to create the database structure, and insert the data, by using the following command:
mysql> SOURCE C:/temp/world.sql;
C:/temp/with the path to the
world.sqlfile on your system.Note
On Windows, use slashes, rather than backslashes, when executing the
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
Another popular sample database is the Sakila database. For additional details, see http://dev.mysql.com/doc/sakila/en/.