Changing the default character set

Материал из Webko Wiki
Перейти к навигации Перейти к поиску


Changing the default character set to UTF-8

vim /etc/my.cnf

[client]
...
default-character-set=utf8mb4
...
[mysql]
...
default-character-set=utf8mb4
...
[mysqld]
...
collation-server = utf8mb4_unicode_ci
init-connect='SET NAMES utf8mb4'
character-set-server = utf8mb4
SET character_set_server = 'utf8mb4';
SET collation_server = 'utf8mb4_unicode_ci';

Create database whith utf8 character

CREATE DATABASE czech_slovak_names 
  CHARACTER SET = 'utf8mb4'
  COLLATE = 'utf8mb4_unicode_ci';

Alter database to utf8 character

ALTER DATABASE czech_slovak_names CHARACTER SET = 'utf8mb4' COLLATE = 'utf8mb4_unicode_ci';