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

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

    If you are confused by your setting for client and conn is reseted after restart mysql service. Try these steps (which worked for me):

    1. vi /etc/my.cnf
    2. add the contents blow and :wq [client] character-sets-dir=/usr/local/mysql/share/mysql/charsets
    3. restart mysql and login mysql , use database, input command status;, you'll find the character-set for 'client' and 'conn' is set to 'utf8'.

    Check the reference for more info.

提交回复
热议问题