Get the App
SLTechnology News&Howtos  ›  Database  › 

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

Shulou Source: shulou.com Published: 2022-06-01 17:40:33 09月21日 Update

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.

Tags: Coding scheme environment solution problem content file more industry affirmation configuration benefit greatly one-off information extension data text text temporary stand-in Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Microsoft Shulou Information Docker Redmi macOS