mac mysql set the default encoding format utf-8

REVIEW

  Bloggers Baidu about it, find mysql change the default encoding format, boils down to the following steps.

detailed steps

Switch the current directory

cd /
cd private/etc

 

New my.cnf file

  In the current directory: private / etc

sudo vim my.cnf 

and then enter the current computer login password

 

Enter the following

After entering the editing interface, press "A", the paste in the following, followed by: Note ":", and enter "WQ"

[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

 

重启mysql服务

 

查看编码格式

 

搞定,以后默认编码格式为:utf-8

Guess you like

Origin www.cnblogs.com/chenyanbin/p/12159850.html