A character set problem caused by MySQL ES1en ES2en ES3en ES4en ES5en
- 2020-06-23 02:08:10
- OfStack
Today, I had to deal with a difficult problem for a colleague. The problem was this:
No matter which version of mysql client is used on the client to connect to the server, you will find that as long as the server is set
character-set-server = utf8
After that,
character_set_client , character_set_connection , character_set_results
It's always one with the server, even with options on the mysql client
--default-character-set=utf8
Also not, unless connected to, and then manually execute the command
set names latin1
, the client, connection, results character set will be changed.
After careful comparison, it turns out that the only thing that got me trashed was another option on the server side:
skip-character-set-client-handshake
The documentation explains this option as follows:
--character-set-client-handshake
Don't ignore character set information sent by the client. To ignore client information and use the default server character set, use --skip-character-set-client-handshake; this makes MySQL behave like MySQL 4.0
So there are some benefits. For example, when the skip-ES30en-ES31en-ES32en-ES33en option is enabled, the client program can avoid misoperation and use other character sets to connect in and write data, thus causing the problem of scrambled code.