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 the mysql character set under linux

2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly explains "how to modify the mysql character set under linux". The content of the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn how to modify the mysql character set under linux.

Modification methods: 1, open and edit the "my.cnf" file; 2, configure the values of "default-character-set", "default-storage-engine", "character-set-server" and other items; 3, save the changes and restart the service.

The operating environment of this tutorial: linux5.9.8 system, mysql8 version, Dell G3 computer.

View the MySQL character set

Log in to mysql:

Mysql-u root-p

Query the mysql character set:

Mysql > show variables like 'chara%'

Description: set the character_set_server character set to UTF-8.

How to modify the mysql character set: set the MySQL character set to UTF-8 by modifying the configuration file

1. Copy the my-default.cnf configuration file to the my.cnf file under / etc.

Cp / usr/share/mysql/my-default.cnf / etc/my.cnf

Note: global information is configured under the etc folder. If there is a my.cnf under etc, you can skip this step. If it does not exist, copy the my-default.cnf to etc and name it my.cnf.

2. Go to the etc directory and open the my.cnf file, and modify the my.cnf as follows.

Edit the my.cnf file

Vi my.cnf

Add the following two sentences to [mysqld]

[client] default-character-set=utf8

Add the following words at the bottom of [mysqld]

Default-storage-engine=INNODB character-set-server=utf8 collation-server=utf8_general_ci

3. Save the modification, and then restart the mysql service.

Service mysql restart

4. Log in to MySQL again to see if the character set has been modified.

Thank you for reading, the above is the content of "how to modify the mysql character set under linux". After the study of this article, I believe you have a deeper understanding of how to modify the mysql character set under linux, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

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

Servers

Wechat

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

12
Report