[MySQL]エラー:java.sql.SQLException: Incorrect string value: '\xF0\x9F\x90\xBB' for column
1689 ワード
問題の原因
MySQL's utf8 only supports basic multilingual plane, and you need to use utf8mb4 instead:
解決策表を作成するときは、ENGINE=InnoDB DEFAULT CHARSET=utf 8 mb 4 COLLATE=utf 8 mb 4_bin; はmyです.cnf上の修正は以下の通り: mysqlサービスを再起動します.備考:mysqlを再起動する必要はありませんが、再起動するしかありません.
参考資料
MySQL's utf8 only supports basic multilingual plane, and you need to use utf8mb4 instead:
解決策
# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.6/en/server-configuration-defaults.html
[client]
default-character-set=utf8mb4
[mysql]
default-character-set = utf8mb4
[mysqld]
character-set-client-handshake = FALSE
character-set-server = utf8mb4
collation-server = utf8mb4_unicode_ci
init_connect='SET NAMES utf8mb4'
# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
# innodb_buffer_pool_size = 128M
# Remove leading # to turn on a very important data integrity option: logging
# changes to the binary log between backups.
# log_bin
# These are commonly set, remove the # and set as required.
# basedir = .....
# datadir = .....
# port = .....
# server_id = .....
# socket = .....
# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M
#log-slow-queries= /usr/local/mysql/log/slowquery.log
参考資料
1. https://stackoverflow.com/questions/13653712/java-sql-sqlexception-incorrect-string-value-xf0-x9f-x91-xbd-xf0-x9f
2. http://www.cnblogs.com/lowwen/p/5645242.html