Mysql table does not display Chinese, garbled solution: first check the encoding method of the database; then edit and open the my.ini file; then modify the content to “default-character-set=utf8”; finally restart the database That’s it.
The various character settings above must be consistent, but simply setting the encoding format for the database and data table cannot completely solve the problem of garbled characters. I will say the above There is a problem of garbled characters that is solved after setting all character encodings to utf8.
Explain the above information:
| character_set_client: The character set (encoding method) of the data requested by the client | character_set_connection: Receive data from the client, and then transmit the character set (the encoding used to establish the connection) | character_set_database: The character set of the default database, no matter how the default database is changed, it is this character set; if there is no default database, then use the character set specified by character_set_server, This variable is recommended to be managed by the system itself, not manually defined. | character_set_results: the character set of the result set | character_set_server: The default character set of the database server | character_set_system: This value is always utf8 and does not need to be set. It is the character set for storing system metadata.
When the values of the above variables are inconsistent or display garbled characters, you can modify them with the following command:
pre class=”brush:php;toolbar:false”>mysql> SET character_set_client = utf8;
mysql> SET character_set_results = utf8;
mysql> SET character_set_cOnnection= utf8;
2. Find the MySQL5.0 installation directory, edit and open the my.ini file, and modify it to:
[client] port=3306 default-character-set=utf8 [mysql] default-character-set=utf8 # The default character set that will be used when a new schema or table is # created and no character set is defined default-character-set=utf8
3. Restart the database.
The above is the detailed content of mysql table does not display Chinese, garbled characters, please pay attention to other related articles on 1024programmer.com!