mysq8 set the default encoding utf8

Set the default encoding mysql utf8

System: centos7 
vi   / etc / my.cnf # If the red part to his presence at the bottom add 

[ Client ] 
default - Character - the SET = utf8 

[ MySQL ] 
default - Character - the SET = utf8 

[ mysql.server ] 
default - Character - SET = UTF8 

[ mysql_safe ] 
default - Character - SET = UTF8 

[ Client ] 
default-character-set=utf8

[mysqld] 
character-set-client-handshake = FALSE
character-set-server=utf8
collation-server = utf8_unicode_ci
init_connect='SET NAMES utf8'

Mysql restart service: service mysqld restart;

View result: show variables like 'character%';

 

 

 

linux mysql open, restart, shut down the service order

First, start

1, start using the service: service MySQL of DStart

Second, stop
1, start using the service: service mysqld STOP


Third, restart
1, start using the service: service mysqld restart

Guess you like

Origin www.cnblogs.com/Zhusi/p/11518060.html