Get the App
SLTechnology News&Howtos  ›  Database  › 

How to solve the problem of mysql5.7.21 utf8 coding in Mac Environment

Shulou Source: shulou.com Published: 2022-05-31 20:43:19 10月02日 Update

This article is about how to solve the mysql5.7.21 utf8 coding problem in Mac environment. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

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.

Thank you for reading! This is the end of this article on "how to solve the problem of mysql5.7.21 utf8 coding in Mac environment". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it out for more people to see!

Tags: Coding content file environment problem more article configuration good practical one-time extension data text article temporary stand-in server step permanent Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno macOS Shulou Technology MariaDB NVidia Linux