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

How to modify MySQL character Encoding

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

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

This article mainly introduces how to modify MySQL character coding, the content of the article is carefully selected and edited by the author, with a certain pertinence, for everyone's reference significance is still relatively great, the following with the author to understand how to modify the MySQL character coding bar.

Mysql converts the character encoding of the table to utf-8

The copy code is as follows:

Alter table tb_anniversary convert to character set utf8

Modify the database mysql character encoding to UTF8

Step 1: view the current character encoding method

The copy code is as follows:

Mysql > show variables like'character%' +-- +-- + | Variable_name | Value | +-- -+ | character_set_client | latin1 | | character_set_connection | latin1 | | character_set_database | latin1 | | character_set_filesystem | binary | | character_set_results | latin1 | | character_set_server | latin1 | | character_set_system | utf8 | | character_sets_dir | / usr/share/mysql/charsets/ | +-- +-- + 8 rows in set (0.00 sec) |

When the character encoding is latin1, the user inserts a record of character type (char) into the data table, and the data of the character type may not be displayed normally when displaying this record, so here we modify the mysql character encoding to UTF8. Do the following:

Step 2: modify the my.cnf configuration file as follows (/ etc/my.cnf):

The copy code is as follows:

[client] # password = your_passwordport = 3306socket = / var/lib/mysql/mysql.sockdefault-character-set=utf8 # set the default encoding to UTF8

The following is the configuration of the blogger

[client] default-character-set=utf8 [mysqld] # default-character-set=utf8character-set-server = utf8

After reading the above about how to modify MySQL character coding, many readers must have some understanding. If you need to get more industry knowledge and information, you can continue to follow our industry information column.

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