MySQLCreating databases

Download MySQL for free

Syntax

  • CREATE {DATABASE | SCHEMA} [IF NOT EXISTS] db_name [create_specification] /// To create database
  • DROP {DATABASE | SCHEMA} [IF EXISTS] db_name /// To drop database

Parameters

ParameterDetails
CREATE DATABASECreates a database with the given name
CREATE SCHEMAThis is a synonym for CREATE DATABASE
IF NOT EXISTSUsed to avoid execution error, if specified database already exists
create_specificationcreate_specification options specify database characteristics such as CHARACTER SET and COLLATE(database collation)

Related Examples

Create database, users, and grants