包说明
mysql-connector-java-5.1.45.jar
MySQL:5.5.28
emoji: 🎽 👖 👘 👙 💼 👜 👝 👛
JSON: \uD83C\uDFBD \uD83D\uDC56 \uD83D\uDC58 \uD83D\uDC59 \uD83D\uDCBC \uD83D\uDC5C \uD83D\uDC5D \uD83D\uDC5B
数据库:? ? ? ? ? ? ? ?
数据库字符集、表等字符集:utf8mb4_unicode_ci、utf8mb4
For Connector/J 5.1.46 and earlier:In order to use the utf8mb4 character set for the connection, the server MUST be configured with character_set_server=utf8mb4; if that is not the case, when UTF-8 is used for characterEncoding in the connection string, it will map to the MySQL character set name utf8, which is an alias for utf8mb3.
5.1.46早期版本,如果要支持 utf8mb4,MySQL Server服务器端必须修改 my.ini 配置文件
[mysqld]
character-set-server=utf8mb4
5.1.47以后版本,utf-8 映射为 utf8mb4,不想修改服务器,就升级下驱动,并设置下连接字符串
spring.datasource.url=jdbc:mysql://localhost:3306/db?characterEncoding=UTF-8
说明
不需要设置 spring.datasource.tomcat.init-s-q-l=SET NAMES utf8mb4,也不清楚事务里面支不支持,并不好使
数据库连接字符串,character_set_server=utf8mb4,试了没用