To start with databases in MySQL we use different queries for creating and using the databases.
First of all to start with the basics we must know how to create a database in MySQL. It is done using the ‘CREATE DATABASE (name)’ query.
Simply open the MySQL Command Line Client on your PC/laptop. Enter your password and start writing the query as shown below.
create database coding_blogs;
The output of the above query is

Notice that in the query create database coding_blogs, the ‘ create database ‘ part is not case sensitive while the name of the database is case sensitive, i.e. if you change the case of the name of database after creating it will show you an error.
After creating the database we must use it to create tables in it. for this ‘USE (Name)’ query is used, as shown below.
use coding_blogs;
The output of the above is as follows:

After this step the user can create the tables inside the created database.
To see how many databases exists we can use the command as shown below:
show databases;
The following is the output of the above query. It will display a table containing the names of all the databases in your MySQL client.

The MySQL command line client looks like this.

Leave a comment