CREATE DATABASE my_database;
If the database is already there then MySQL will return error. We can check first before creating the database.
CREATE database IF NOT EXISTS my_database;
The user account must have privileges to create database. Contact your database admin to get required privilege if you are getting ERROR 1044 (42000): Access denied for user message.
SELECT DATABASE()

SHOW databases;
We can use LIKE to filter the listing of database
SHOW databases LIKE '%plus2%';
This will list all databases having plus2 any where in the database name.
USE my_database;
With this our my_database is available to us.
DROP DATABASE my_database;
If the database is not available then this will generate error, so we can check before deleting.
DROP DATABASE IF EXISTS my_database;
Author & Instructor at plus2net
I write and maintain practical tutorials on Python, PHP, SQL, JavaScript, HTML, jQuery, and web development at plus2net. The tutorials focus on clear explanations, working examples, and code that readers can test and adapt while learning.