Mysql character set is always set to UTF-8

1. Create a file in a virtual machine under / usr path name: mysql.cnf

cd /usr

touch mysql.cnf

2. insert commands vim arranged in the text file

vim mysql.cnf

Press i to enter edit mode, paste the following:

[client]
default-character-set=utf8


[mysql]
default-character-set=utf8

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

    Note that the text can not be free at the end of the line;

    Pressing the Alt + Shift + Q , the input x and press Enter to save and exit the editor vim

3. The container cover profile

docker cp /usr/mysql.cnf container ID : /etc/mysql/mysql.conf.d/mysql.cnf

 

carry out

Guess you like

Origin www.cnblogs.com/whoyoung/p/10987966.html