How to Load the Sample Database into MySQL Server

How to Load the Sample Database into MySQL Server

 

How to Load the Sample Database into MySQL Server




Summaryin this tutorial, you will learn how to load the sample database into your MySQL Server using the mysql program.

Step 1

Download the classicmodels database from the MySQL sample database section.

Step 2

Unzip the downloaded file into a temporary folder. You can use any folder you want. To make it simple, we will unzip the file to the C:\temp  folder.

If you use another operating system such as macOS, Linux, or Unix, please feel free to unzip it to any directory you like.

Step 3

Connect to the MySQL server using the mysql client program. The mysql program is located in the bin directory of the MySQL installation folder.

> mysql -u root -p Enter password: ********

You will need to enter the password for the root user account to log in.

Step 4

Use the source the command to load data into the MySQL Server:

mysql> source c:\temp\mysqlsampledatabase.sql

Step 5

Use the SHOW DATABASES the command to list all databases in the current server:

mysql> show databases;

The output will look like the following that includes the newly created classicmodels database:

+--------------------+ | Database | +--------------------+ | classicmodels | | information_schema | | mysql | | performance_schema | | sys | +--------------------+

In this tutorial, you have learned step by step how to load the sample database into MySQL server using the mysql tool.

Reactions

Post a Comment

0 Comments

close