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

前端 未结 18 971
一个人的身影
一个人的身影 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:19

    MySQL v5.5.3 and greater:

    Just add three lines only in the [mysqld] section:

    [mysqld]
    character-set-server = utf8
    collation-server = utf8_unicode_ci
    skip-character-set-client-handshake
    

    Note: Including skip-character-set-client-handshake here obviates the need to include both init-connect in [mysqld] and default-character-set in the [client] and [mysql] sections.

提交回复
热议问题