mybatis connection MySQL garbled

 First of all I want to say this. For me one afternoon pit

First problem is that I connect with mysql mybatispuls

 

first step

jdbc:mysql://localhost:3306/11e?useUnicode=true&characterEncoding=UTF-8

 

 First connection changed. Set utf-8, but does not solve the problem found

The second step.

Then I is not no not configured my.cnf 

Find my.cnf MySQL used

the AUX PS | grep MySQL | grep ' my.cnf ' discovery was not found. 

MySQL --help | grep ' my.cnf ' Use this command found

 

Create a my.cnf in etc / under

# Default Homebrew MySQL server config
[mysqld]
# Only allow connections from localhost
bind-address = 127.0.0.1
default-character-set=utf8
[mysqld]
character-set-server=utf8
init_connect=’SET NAMES utf8’
[client]
default-character-set=utf8mb4

 

MySQL: [Warning] World-Writable config File ' /etc/my.cnf '  IS ignored because this is too much authority to configure MySQL MySQL considered at risk of automatic ignored

 

Then I modified chmod 644 /etc/my.cnf this time you can use 

But I found still not resolved

third step

Because I'm using MySQL8.0 then I changed to 5.1 drive is not resolved.

the fourth step

I enter the command line using the mysql -uroot inquiry found that I was a Chinese show

 

The reason most pits have been found because I was connected navicat 

 

I created a connection

This time I found my character is right

 

Guess you like

Origin www.cnblogs.com/bj-xiaodao/p/11025110.html