Thursday, September 28, 2017

Create and Drop Database in MySQL/MariaDB

A. Create New Database

Database is the collection of tables in a relational database. The first task in learning how to use a database is to create a new database. In MySQL console, the task to create a new database is done using the following command:
The italic words in bracket [] is the name of the new database. The result of the command in action is show in Figure 1 below.
Figure 1: Create a new database using SQL 
B. Remove an Existing Database

[Beware!! This action cannot be undo. only use the given SQL when you are sure you want to remove certain database!]

Remove database is also part of important task when managing a database. An existing database in the MySQL / MariaDB database can be remove using the following command:
The italic words in bracket [] is the name of the database that the user want to remove. The result of the command in action is show in Figure 2 below.
Figure 2: Removing a database from MySQL/MariaDB