Home > Database > Mysql Tutorial > How to solve the problem of garbled mysql comments

How to solve the problem of garbled mysql comments

藏色散人
Release: 2023-02-13 09:44:59
Original
3074 people have browsed it

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.

How to solve the problem of garbled mysql comments

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

How to solve the problem of garbled mysql comments

Check the reason:

这两条命令查看数据库与服务端的字符集设置

show variables like '%colla%';
show variables like '%char%';
Copy after login

How to solve the problem of garbled mysql comments

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;
Copy after login

How to solve the problem of garbled mysql comments

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!

Related labels:
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
MySQL stops process
From 1970-01-01 08:00:00
0
0
0
Error when installing mysql on linux
From 1970-01-01 08:00:00
0
0
0
phpstudy cannot start mysql?
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template