Reputation: 2408
When creating a MySQL database with CREATE SCHEMA
, it uses MySQL's default character set and collation. But I want to change that.
How do I create a MySQL Database with a specific character set and collation?
Upvotes: 1
Views: 3361
Reputation: 172438
You can try like this:
CREATE DATABASE IF NOT EXISTS someDatabase
DEFAULT CHARACTER SET = 'utf8' DEFAULT COLLATE 'utf8_general_ci'
and if the database is already created, then you can alter is like this:
ALTER DATABASE databasename CHARACTER SET utf8 COLLATE utf8_unicode_ci;
Upvotes: 5
Reputation: 2408
CREATE SCHEMA `my_database`
DEFAULT CHARACTER SET utf8
COLLATE utf8_unicode_ci ;
Upvotes: 0