1. 程式人生 > >MySQL 更新中文列:1366 Incorrect string value 問題解決

MySQL 更新中文列:1366 Incorrect string value 問題解決

環境:Win7 64位,mysql-5.6.25-winx64,MySQL workbench

問題:MySQL更新時出現異常:

 warning(s): 1366 Incorrect string value: '\xE8\x82\x96\xE5\xB1\xB1...' for column 'sub_station_name'

解決:

1、資料庫schema字符集設定為utf-8

2、表字符集設定為utf-8

3、中文列字符集設定為utf-8

4、連線url裡面已經指定了CharsetEncode=utf8

第4步非常關鍵。

備註:

1、看資料庫字符集

show create database test;

注:test為資料庫名。

2、看資料表字符集
show create table t_data;

注:t_data為表名。