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

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

    Change MySQL character:

    Client

    default-character-set=utf8
    

    mysqld

    character_set_server=utf8
    

    We should not write default-character-set=utf8 in mysqld, because that could result in an error like:

    start: Job failed to start

    At last:

     +--------------------------+----------------------------+
     | Variable_name            | Value                      |
     +--------------------------+----------------------------+
     | character_set_client     | utf8                       |
     | character_set_connection | utf8                       |
     | character_set_database   | utf8                       |
     | character_set_filesystem | binary                     |
     | character_set_results    | utf8                       |
     | character_set_server     | utf8                       |
     | character_set_system     | utf8                       |
     | character_sets_dir       | /usr/share/mysql/charsets/ |
     +--------------------------+----------------------------+
    

提交回复
热议问题