mybatis-plus logging 日志上的中文正常,但是到mysql数据库就乱码

本文探讨了如何在数据库连接URL中添加参数,以确保使用Unicode字符集并设定字符编码为utf8。这对于处理多语言内容和确保数据正确存储至关重要。

在数据库连接url上添加参数
?useUnicode=true&characterEncoding=utf8

# Tomcat server: tomcat: uri-encoding: UTF-8 port: 9090 address: 0.0.0.0 servlet: context-path: /springbootw12d6cw5 spring: datasource: driverClassName: com.mysql.cj.jdbc.Driver url: jdbc:mysql://127.0.0.1:3306/db_creamics?useUnicode=true&characterEncoding=utf-8&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2B8&useSSL=false username: root password: root # driverClassName: com.microsoft.sqlserver.jdbc.SQLServerDriver # url: jdbc:sqlserver://127.0.0.1:1433;DatabaseName=springbootw12d6cw5 # username: sa # password: 123456 servlet: multipart: max-file-size: 300MB max-request-size: 300MB #mybatis mybatis-plus: mapper-locations: classpath*:mapper/*.xml #实体扫描,多个package用逗号或者分号分隔 typeAliasesPackage: com.entity global-config: #主键类型 0:"数据库ID自增", 1:"用户输入ID",2:"全局唯一ID (数字类型唯一ID)", 3:"全局唯一ID UUID"; id-type: 1 #字段策略 0:"忽略判断",1:"非 NULL 判断"),2:"非空判断" field-strategy: 1 #驼峰下划线转换 db-column-underline: true #刷新mapper 调试神器 refresh-mapper: true #逻辑删除配置 logic-delete-value: -1 logic-not-delete-value: 0 #自定义SQL注入器 sql-injector: com.baomidou.mybatisplus.mapper.LogicSqlInjector configuration: log-impl: org.apache.ibatis.logging.stdout.StdOutImpl map-underscore-to-camel-case: true cache-enabled: false call-setters-on-nulls: true #springboot 项目mybatis plus 设置 jdbcTypeForNull (oracle数据库需配置JdbcType.NULL, 默认是Other) jdbc-type-for-null: 'null' logging: level: com.tc.mapper: debug pattern: dateformat: MM-dd HH:mm:ss:SSS
最新发布
09-19
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值