MybatisPlus模糊查询(like),查询不到中文,却可以查询到英文和数字的一种解决办法

问题描述

最近使用MybatisPlus对MySQL数据库查询时,遇到了这个问题:使用模糊查询语句时,可以查询英文,中文查询不到

解决办法

查了很多解决办法,最后发现MySQL链接未指定编码

例如:springboot配置文件application.properties(加红色标记的为指定编码)

spring.datasource.url=jdbc:mysql://127.0.0.1:3306/test?useUnicode=true&characterEncoding=utf-8&rewriteBatchedStatements=true
spring.datasource.username=root
spring.datasource.password=root

加上指定编码后,完美解决!

转:https://blog.csdn.net/u012833739/article/details/99455483

原文地址:https://www.cnblogs.com/LJing21/p/14177505.html