Change MySQL default character set to UTF-8 in my.cnf?

前端 未结 18 1274
一个人的身影
一个人的身影 2020-11-22 01:55

Currently we are using the following commands in PHP to set the character set to UTF-8 in our application.

Since this is a bit of overhead, we\'d like to set this a

18条回答
  •  忘掉有多难
    2020-11-22 02:07

    On Fedora 21

    $ vi /etc/my.cnf
    

    Add follow:

    [client]
    default-character-set=utf8
    
    [mysql]
    default-character-set=utf8
    
    [mysqld]
    init_connect='SET collation_connection = utf8_unicode_ci'
    init_connect='SET NAMES utf8'
    character-set-server=utf8
    collation-server=utf8_unicode_ci 
    skip-character-set-client-handshake
    

    Save and exit.

    Final remember restart service mysqld with service mysqld restart.

提交回复
热议问题