MySQL Chinese garbled problem

Problem Description:

When writing Chinese data through mybatis, garbled characters appear. Through the output view, we know that the Chinese passed from the front end to the back end is normal, and the Chinese output in mybatis is also normal. Therefore, the problem location is either a problem with the character set in the connection to access the database, or a problem with the character set setting of mysql itself. After inspection, it is found that the character set of mysql is all utf-8 and there is no problem, then there must be a problem with the character set setting in the connection.

Later, check the connection and find that the connection is in the following format:

jdbc:mysql://127.0.0.1:3306/test?useUnicode&characterEncoding=utf8

It should actually be:

jdbc:mysql://127.0.0.1:3306/test?useUnicode&&characterEncoding=utf8

 

Otherwise, the characterEncoding set later will not work at all

 

In addition, when executing a mysql script through Aqua Data Studio, the delimiter of the statement must be set first, otherwise only a single statement can be executed

Right-click on the database --> Script Options --> Script



 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326402572&siteId=291194637