MySQL Create Database

  • We can create Database in MySQL using CREATE DATABASE.
  • To create database, you need CREATE Privilege for the database.
  • CREATE SCHEMA is a synonym for CREATE DATABASE.

MySQL CREATE DATABASE Syntax:

CREATE {DATABASE | SCHEMA} [IF NOT EXISTS] db_name [create_specification] ... create_specification: [DEFAULT] CHARACTER SET [=] charset_name | [DEFAULT] COLLATE [=] collation_name

Create database with the name company.

mysql> create database company;

mysql> show databases;

+--------------------+ | Database | +--------------------+ | information_schema | | company | | mysql | | performance_schema | | sakila | | sys | +--------------------+

mysql> use company;
Database changed