鍦╓indwos涓婁娇鐢ㄥ懡浠ょ獥鍙f搷浣淢ySQL鏁版嵁搴撴椂锛屽鏋滃懡浠ょ獥鍙g殑瀛楃缂栫爜涓庢暟鎹簱涓嶄竴鑷存椂锛屽氨浼氬嚭鐜颁腑鏂囦贡鐮佺殑鎯呭喌
寰俊鍏紬鍙峰紑鍙戞壘涓婃捣鎹岃穬缃戠粶绉戞妧鏈夐檺鍏徃QQ3343874032
姣斿鏌ヨ浼氬嚭鐜颁腑鏂囦贡鐮侊紝鎴栬�呮彃鍏ユ暟鎹細鍑虹幇閿欒鈥淓RROR 1366 (HY000): Incorrect string value: '\xD5\xC5\xC8\xFD' for column 'name' at row 1鈥�
mysql>聽insert聽into聽user(name,gender,age)聽values('寮犱笁','鐢�',22);
ERROR聽1366聽(HY000):聽Incorrect聽string聽value:聽'\xD5\xC5\xC8\xFD'聽for聽column聽'name'聽at聽row聽1
mysql>聽select聽*聽from聽user;
+----+----------+--------+-----+---------------------+|聽id聽|聽name聽聽聽聽聽|聽gender聽|聽age聽|聽updated_time聽聽聽聽聽聽聽聽|
+----+----------+--------+-----+---------------------+|聽聽1聽|聽zhangsan聽|聽M聽聽聽聽聽聽|聽聽22聽|聽2018-10-31聽17:03:25聽|
|聽聽2聽|聽瀵姳绗伮犅犅犅犅爘聽閻�?聽聽聽聽|聽聽22聽|聽2018-11-01聽09:01:43聽|
+----+----------+--------+-----+---------------------+2聽rows聽in聽set聽(0.00聽sec)
杩欐椂鍙互鍏堟煡鐪嬩笅鐜缂栫爜閰嶇疆锛屾垜鐨勬槸utf8锛岀粨鏋滄槸涓嬮潰杩欐牱
mysql>聽show聽variables聽like聽'char%';
+--------------------------+---------------------------------------------------------+|聽Variable_name聽聽聽聽聽聽聽聽聽聽聽聽|聽Value聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽|
+--------------------------+---------------------------------------------------------+|聽character_set_client聽聽聽聽聽|聽utf8聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽|
|聽character_set_connection聽|聽utf8聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽|
|聽character_set_database聽聽聽|聽utf8聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽|
|聽character_set_filesystem聽|聽binary聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽|
|聽character_set_results聽聽聽聽|聽utf8聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽|
|聽character_set_server聽聽聽聽聽|聽utf8聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽|
|聽character_set_system聽聽聽聽聽|聽utf8聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽|
|聽character_sets_dir聽聽聽聽聽聽聽|聽C:\Program聽Files\MySQL\MySQL聽Server聽5.5\share\charsets\聽|
+--------------------------+---------------------------------------------------------+8聽rows聽in聽set聽(0.00聽sec)
鏌ョ湅windwos鍛戒护绐楀彛鐨勭殑灞炴�у彲鐭ワ紝缂栫爜鏍煎紡涓篏BK涓斾笉鑳芥洿鏀�
杩欐椂鎴戜滑鍙互浣跨敤鈥渟et names gbk;鈥濇潵鎸囧畾瀹㈡埛绔彂閫佺粰mysql璇彞鏃剁殑缂栫爜鏍煎紡锛屽苟涓斿彲浠ョ湅鍒癱lient銆乧onnection銆乺esults涓変釜鍙橀噺鐨勭紪鐮佹牸寮忓彉涓轰簡gbk锛屽叾瀹冪殑娌℃湁鍙樺寲
mysql>聽set聽names聽gbk;
Query聽OK,聽0聽rows聽affected聽(0.00聽sec)
mysql>聽show聽variables聽like聽'char%';
+--------------------------+---------------------------------------------------------+|聽Variable_name聽聽聽聽聽聽聽聽聽聽聽聽|聽Value聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽|
+--------------------------+---------------------------------------------------------+|聽character_set_client聽聽聽聽聽|聽gbk聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽|
|聽character_set_connection聽|聽gbk聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽|
|聽character_set_database聽聽聽|聽utf8聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽|
|聽character_set_filesystem聽|聽binary聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽|
|聽character_set_results聽聽聽聽|聽gbk聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽|
|聽character_set_server聽聽聽聽聽|聽utf8聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽|
|聽character_set_system聽聽聽聽聽|聽utf8聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽|
|聽character_sets_dir聽聽聽聽聽聽聽|聽C:\Program聽Files\MySQL\MySQL聽Server聽5.5\share\charsets\聽|
+--------------------------+---------------------------------------------------------+8聽rows聽in聽set聽(0.00聽sec)
鍐嶆鎵ц涓嬫彃鍏ユ搷浣滄病闂浜嗭紝鏌ヨ鏁版嵁涓枃涔熶笉浼氫贡鐮佷簡
mysql>聽insert聽into聽user(name,gender,age)聽values('寮犱笁','鐢�',22);
Query聽OK,聽1聽row聽affected聽(0.04聽sec)
mysql>聽select聽*聽from聽user;
+----+----------+--------+-----+---------------------+|聽id聽|聽name聽聽聽聽聽|聽gender聽|聽age聽|聽updated_time聽聽聽聽聽聽聽聽|
+----+----------+--------+-----+---------------------+|聽聽1聽|聽zhangsan聽|聽M聽聽聽聽聽聽|聽聽22聽|聽2018-10-31聽17:03:25聽|
|聽聽2聽|聽寮犱笁聽聽聽聽聽聽聽聽聽|聽鐢仿犅犅犅犅犅犅爘聽聽22聽|聽2018-11-01聽09:01:43聽|
+----+----------+--------+-----+---------------------+2聽rows聽in聽set聽(0.00聽sec)
杞嚜锛歨ttp://blog.51cto.com/14009535/2313066