Query MySQL garbled characters in the windows command line mysql utf8 garbled in the windows command line
If you want to set the database encoding to utf8, you must first set
The default-character-set attribute is set to utf8, that is
Default-character-set = utf8
Show variable like 'char % ';
Command to check whether all character sets have been changed to utf8. If yes, you have set them successfully.
After setting it to utf8, if you use the management tool to operate mysql, you will find that the Chinese field value is correct, but if you use the command line to query it, garbled characters will occur. when you insert the Chinese field value, the error message "Incorrect string value: '/xD6/xD0/xCE/xC4' for column" is also prompted, which may be related to the encoding page of the windows command line encoded as gbk.
Solution: enter the command before performing the query or update operation.
Set names gbk;
This command can set the encoding with three configurations to gbk.
In this way, Chinese operations can be performed normally.
You can enter
Set names utf8;