Solution to the problem of garbled mysql comments: 1. Check the character set settings of the database and server through the "show variables like '%colla%';show variables like '%char%';" command; 2. Through "set character_set_client=utf8;" just set the result set to utf8.
The operating environment of this tutorial: Windows 10 system, Mysql5.7.14 version, Dell G3 computer.
How to solve the problem of garbled mysql comments?
mysql table comments are garbled
Problem: There are comments in the fields in the table when creating the table. Use show create table table_name; to view the fields in the displayed table. The comments are garbled, as follows
Check the reason:
这两条命令查看数据库与服务端的字符集设置 show variables like '%colla%'; show variables like '%char%';
As expected, the problem lies in the character set problem, because of the wrong setting Set names gbk is used, resulting in the result not being encoded in utf8;
Set the following statement to solve the problem.
set character_set_results=utf8; 返回结果集设置为utf8; set character_set_client=utf8; set collation_connection= utf8_general_ci;
Recommended study: " MySQL video tutorial》
The above is the detailed content of How to solve the problem of garbled mysql comments. For more information, please follow other related articles on the PHP Chinese website!