Mysql5.7.21 utf8 encoding problem and solution in Mac environment, mysql5.7.21utf8

Source: Internet
Author: User

Mysql5.7.21 utf8 encoding problem and solution in Mac environment, mysql5.7.21utf8

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

Temporary: SET character_set_server = utf8.

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

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

Create my. cnf. You can directly change the extension to cnf after creating this file. It is better to open it with Xcode or subline. The content is 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: In fact,/etc is a replacement of/private/etc, which can be copied to both.

4. Restart the mysql server and enter mysql

Mysql> show variables like '% char % ';

We can find that the encoding values are changed to utf8.

Create a new database and then import the data to display Chinese characters.

Summary

The above section describes the Problem and Solution of utf8 encoding in mysql5.7.21 in the Mac environment. I hope it will help you. If you have any questions, please leave a message, the editor will reply to you in a timely manner. Thank you very much for your support for the help House website!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.