Skip to content

Set MySQL's character set to UTF 8

SgLy edited this page Nov 1, 2017 · 1 revision

follow guides below to set MySQL's character set to UTF-8:

Windows

Stop MySQL service firstly. After that, create a file name my.ini under the root directory of your MySQL with the following content:

[client]
default-character-set=utf8

Then restart your MySQL service

Linux

Stop MySQL service and add following codes to /etc/my.cnf:

[client]
default-character-set=utf8
[mysqld] 
default-storage-engine=INNODB  
character-set-server=utf8  
collation-server=utf8_general_ci 

Then restart your MySQL service

macOS

Stop the MySQL service and add the following codes to /private/etc/my.cnf

[client]
default-character-set=utf8

[mysql]
default-character-set=utf8

[mysqld]
collation-server = utf8_unicode_ci
init-connect='SET NAMES utf8'
character-set-server = utf8

Then restart your MySQL service

Clone this wiki locally