By using this site you agree to the use of cookies by Brugbart and our partners.

Learn more

Create a database with utf8 Character Set in MySQL

How to create database with a specific character set.

Edited: 2015-07-10 16:44

To create a MySQL database using the UTF8 as character set, use the bellow query:

CREATE DATABASE dbname CHARACTER SET utf8 COLLATE utf8_bin;

Worth to know about character sets and collations

The first part in this example, controls which character set of the data itself in the database, the second is called the collation, or simply collate, this part controls how comparisons should be performed. For example, whether a comparison should be case-sensitive.

If you want queries to be case-insensitive by default, then use the utf8_general_ci collation, otherwise use utf8_bin instead.

collations contain the rule-sets used for comparing characters in a character set, while the character sets themselves is the actual encoding of the data in the database.