How to create database/Schema in MySQL or MairaDB - MySQL Developer Tutorial

Schema or Database is logical structure in MySQL or MairaDB which consists of tables, views, stored procedures , functions, triggers and other objects. Tables are the objects which are used to store the data in Schema / Database.

While choosing the database name or schema name in MySQL, keep in mind below restrictions


  1. Database name in MySQL cannot be longer than 64 characters.
  2. Database name in MySQL cannot contain / \ or . characters.
  3. Database name in MySQL cannot contain characters that are not permitted in file names.
  4. Database name in MySQL cannot end with space character.
You can have space in the database name or schema name in MySQL, in that case you have to use acute character ` around database name or schema name.

Create schema or database in MySQL:


Syntax to create database or schema in MySQL

Create Schema/Database [Schema or DatabaseName];

Let's say if I want to create techbrothers, I can either of below statement.

Create Schema techbrothers;

Or
Create Database techbrothers;


In case if I need to have space between the tech and brothers, then I will be using acute characters around the database name.
Create database `tech brothers`;

Drop Schema or Database in MySQL: 

Syntax to drop schema or database in MySQL
Drop Schema/Database [Schema or Database Name]


Video Demo : How to create Schema or Database in MySQL and Drop Schema

2 comments: