Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The solution of character error caused by mysql garbled code

2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

The main purpose of this article is to tell you briefly about the solutions to character errors caused by mysql garbled codes. You can check the relevant professional terms on the Internet or find some related books to supplement them. We will not dabble here, so let's go straight to the topic. I hope this article on the solutions to character errors caused by mysql garbled codes can bring you some practical help.

Very few do not pay attention to the garbled code in the database, resulting in character errors:

The default is the Latin character set:

The tables created in this library are also Latin character sets:

Insert normal data below:

The display is normal.

When inserting Chinese: the client must be set to the Latin character set.

Another way is to edit the xpg.sql; outside and pour it in with system

Five methods of mysql non-garbled code and their root causes

Set name

two。 Specify set name in the sql file

3. Use-- default-charcater-set=latin1 in the command

4. Modify my.cnf

The idea of non-garbled code: the unity of client, server, library, table and program

System: system files, different systems are different. Centos7's [root@ceshi ~] # vi / etc/locale.conf

Client: set names is to modify the client character set.

Server: modify my.cnf

Library table: create database test default character set utf8

Learn about these two commands:

Show variables

Status of show global status; mysql

And modify the mysql parameter without restarting mysql.

The modification is set global key_buffer_size=

The view is: show variables like "key_buffer%"

View the character set of the client, server, and system

They are: client character set, connection character set, database character set, return character set, server character set, system character set.

What exactly did the executive set names do?

The result of set name is to modify the client, connect, and return the resulting character set.

And only temporarily modified.

The mysql command-- the results of default-character-set=latin1 and set names are the same.

Unify the character set of the client and the server

[client]

Default-character-set=utf8

[mysqld]

Default-character-set=utf8

Such a change requires a restart of mysql.

Mysql garbled character errors caused by the solution to tell you here, for other related issues you want to know can continue to pay attention to our industry information. Our section will capture some industry news and professional knowledge to share with you every day.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report