mysql green version setting encoding,And 1067 errors

View mysql coding

show variables like "char%";

Because the character set was specified as utf8 during the initial installation, all encodings are utf8.

character_set_client:The data you send must match the encoding specified by the client! !! !! The server will use this encoding to interpret the data sent by the client; character_set_connection:This code is consistent with the client! The encoding will not cause garbled characters! When a query is executed,The data sent by the client will first be converted into the encoding specified by the connection.But as long as the data sent by the client is consistent with the encoding specified by the client,Then there is no problem with the conversion; character_set_database:database default encoding,When creating a database,If no encoding is specified,Then the database encoding is used by default; character_set_server:the default encoding of the mysql server; character_set_results:the encoding of the response,The encoding returned by the query result to the client.This means that the client must use the encoding specified by result to decode;
Modify character_set_client, character_set_results, character_set_connection to gbk,There will be no garbled characters.
But you only need to modify character_set_client and character_set_results.

The encoding of the console can only be gbk, and cannot be modified to utf8, which brings up a problem.The data sent by the client is gbk, and character_set_client is utf8, which means that the client data will garbled when it reaches the server.Since the encoding of the console cannot be modified,Then you can only modify character_set_client to gbk.

The data sent by the server to the client is character_set_result. If it is utf8, the console will use gbk to decode.Because the console encoding cannot be modified,So you can only change character_set_result to gbk.

Fill in this sentence:

Here is the overall configuration:

#for advice on how to change settings please see
#*** do not edit this file. it "s a template which will be copied to the
#*** default location during install, and will be replaced if you
#*** upgrade to a newer version of mysql.
basedir=h:\ mysql
datadir=h:\ mysql \ data
#remove leading #and set to the amount of ram for the most important data
#cache in mysql. start at 70%of total ram for dedicated server, else 10%.
#remove leading #to turn on a very important data integrity option:logging
#changes to the binary log between backups.
#these are commonly set, remove the #and set as required.
#remove leading #to set options mainly useful for reporting servers.
#the server defaults are faster for transactions and fast selects.
#adjust sizes as needed, experiment to find the optimal values.
sql_mode=no_engine_substitution, strict_trans_tables

1067 error

Note that the configuration in my.ini is not wrong.In fact, many of our 1067 errors are mismatched in my.ini.


In windows10, in fact, setting default-character-set=utf8, and then operating in cmd will not garble.But in windows8.1, windows7 will be garbled.So in windows8.1 and windows7 you must set default-character-set=gbk to gbk

  • Previous Detailed installation of docker ce on Ubuntu1610
  • Next CountDownTimer implements countdown function in Android