Skip to content

Latest commit

 

History

History
44 lines (29 loc) · 1.34 KB

mysql_create_db.md

File metadata and controls

44 lines (29 loc) · 1.34 KB

Go to Home Page


MySQL

CREATE {DATABASE | SCHEMA} [IF NOT EXISTS] db_name
  [create_specification] ...

  create_specification:
    [DEFAULT] CHARACTER SET [=] charset_name
  | [DEFAULT] COLLATE [=] collation_name

  • CREATE DATABASE creates a database with the given name

  • CREATE SCHEMA is a synonym for CREATE DATABASE.

  • Error occure if db already exists, so use IF NOT EXISTS

  • create_specification - specify db characteristics , these characterstics are stored in db.opt file in db directiory

    • CHARACTER SET clause specifies default character set
    • COLLATE clause specifies default database collation (Collect and combine (texts, information, or sets of figures) in proper order.)
    • Different Character Set and Collation info

    Why Character Set & Collate?

    MySQL Character set support that enables you store data using of character set - Use at server, database, table, and column level - used for the MyISAM, MEMORY, NDBCLUSTER, InnoDB storage engine Perform comparisons according to variety of collation

Req:
* need create privilege for the db
*

Go to Home Page