Changing the default character set
Версия от 10:33, 28 февраля 2018; Sol (обсуждение | вклад) (Новая страница: «Категория:DB == Changing the default character set to UTF-8 == ''vim /etc/my.cnf'' <syntaxhighlight lang="bash"> [client] ... default-character-se…»)
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';