Add Chinese characters to the table in MySQL with CMD window

Today, I encountered a problem in learning MySQL: add Chinese characters found not add to the table with a cmd window, newspaper ERROR 1366 (HY000): Incorrect string value: '\ xBC \ xBE \ xBE \ xFC' for column 'name' at row 1 this wrong. I guess the question is coded, so check my mysql encoding is utf8, and supposedly will not go wrong. Later I found when looking at someone else's blog this problem lie a.

I originally cmd window using the encoding gbk, mysql and encoding cmd is conflict, resulting in the failure of Chinese characters is added to the table.

solution:

In mysql software encoded on a set utf8, mysql added directly to the table kanji

show variables like "% character%" // display the coding mysql

 

 set character_set_client = utf8; // the client side mysql modify the coding format utf8

The encoding settings for these properties after utf8, we can directly in mysql in the Chinese character input into the table

2 modified in the same coding attributes mysql encoding it and cmd window, on the character input window cmd to the table.

  set names gbk; // mysql in the modified coding format matched with cmd.

  Use show variables like "% character%" displayed in mysql encoding format.

Guess you like

Origin www.cnblogs.com/zhangyang4674/p/11587146.html