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

Mysql5.7.21 utf8 coding problem and its solution in Mac Environment

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

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

Next, let's learn about the mysql5.7.21 utf8 coding problems and solutions in the Mac environment. I believe you will benefit a lot after reading it. The text is not much in the essence. I hope the short content of mysql5.7.21 utf8 coding problems and solutions in the Mac environment is what you want.

1. Goal: change the value of character_set_server for mysql from latin1 to utf8

Temporary: SET character_set_server=utf8 can be, one-time.

Permanent: you need to change the configuration file, see step 2.

2. There is no configuration file in the support-files of mysql 5.7.21.

Create a new my.cnf. You can create a text file and directly change the extension to cnf. It is better to open it with Xcode or subline. The contents are as follows:

[mysqld] character-set-server=utf8 [client] default-character-set=utf8 [mysql] default-character-set=utf8

3. Copy my.cnf to / private/etc/

Cp / usr/local/mysql/support-files/my.cnf / private/etc/my.cnf

Note: / etc is actually a stand-in for / private/etc, which can be copied to both.

4. Restart the mysql server and enter mysql

Mysql > show variables like'% char%'

You can see that the coding values are changed to utf8.

At this time, rebuild the database and build the table, and the imported data can be displayed in Chinese normally.

After reading this article on mysql5.7.21 utf8 coding problems and solutions in Mac environment, many readers will want to know more about it. If you need more industry information, you can follow our industry information section.

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