MySQL Creating & Deleting Databases

Creating databases is quite simple. Open the MySQL Command Line Client (from now on we will call this CLC or CLI) which can be found in the start menu. When you start it, you will find that it's a small application with a black background. It will tell you to enter your password, which is the password you entered at setup. Enter your password and then you should see something like this:

MySQL Command Line Client

From now on, the majority of our work will be done here and with notepad++.

Creating a Database

Syntax

CREATE DATABASE IF NOT EXISTS data-base-name;

Example

We will create one database that we will work on for the rest of the MySQL tutorials. We are going to invent a gaming company called ClosedEyeStudios. We will name the database CES.

CREATE DATABASE IF NOT EXISTS ces;

To make sure that the database has been created, we use the command Show Databases; to list the databases.

SHOW DATABASES;

Make sure your database CES is there. You will see other databases, but ignore these as they are automatically created.

Deleting Databases

Syntax

DROP DATABASE database_name;

Example

DROP DATABASE ces;

This will delete the database we just made (CES). Make sure you re-create the database after trying this.