MySQL Part 2: Create Database



Introduction

In this article, we will walk through how to create a MySQL database.  For more information about setting up MySQL through the goormIDE, please check out Part 1 of this series.


Create Database

A database is a place where we can store multiple tables that will ultimately house our data.  If you started a new MySQL session, please type the following into the Terminal and press <Enter>.

mysql-ctl cli

Please ensure that the bike_shop.sql file is selected and available.  If not, double-click it on the left-hand side.  This is where we are going to create our database.

















Type the following code into the console.  Press Ctrl+S to save the code.

DROP DATABASE IF EXISTS bike_shop_app;
CREATE DATABASE bike_shop_app;
USE bike_shop_app;









To run the code, go down to the Terminal and type the following code that will run the bike_shop.sql file and press <Enter>.

SOURCE bike_shop.sql;








You will get the message "Query OK" if you complete the steps correctly.  Congratulations, if you made it this far, you have successfully set up a database in MySQL.

For a complete list of the entire set of MySQL-related articles, please see the links below.

MySQL Part 1: goormIDE
MySQL Part 2: Create Database
MySQL Part 3: Create Tables
MySQL Part 4: String Functions
MySQL Part 5: Refining Select Statements
MySQL Part 6: Aggregations
MySQL Part 7: Dates
MySQL Part 8: Logical Operations
MySQL Part 9: Joins




Popular posts from this blog

MySQL Part 1: Getting MySQL Set Up in goormIDE

Do Popular Market Index Returns Follow a Normal Distribution?