Mysql inserts Chinese Characters in mac to solve the problem. macmysql

Source: Internet
Author: User
Tags mysql command line

Mysql inserts Chinese Characters in mac to solve the problem. macmysql

After several hours, I finally got it done.

The root cause of garbled characters is the differences in encoding methods. As long as the encoding methods are unified, there is no problem.

1. Enter the mysql command line and use show variables like 'character _ set _ % '; to view the Encoding

| Character_set_client | utf8
| Character_set_connection | utf8
| Character_set_database | utf8
| Character_set_filesystem | binary
| Character_set_results | utf8
| Character_set_server | utf8
| Character_set_system | utf8

Make sure all encoding methods are utf8.

2. If it is not utf8, perform the following operations:

Stop mysql service first: sudo/Library/StartupItems/MySQLCOM stop

Copy any *. cnf under/usr/local/mysql/support-files to/etc/my. cnf and add the following configuration

[Mysqld]
Character-set-server = utf8
[Client]
Default-character-set = utf8

3. Restart mysql: sudo/Library/StartupItems/MySQLCOM start

4. Create a new database and table.

Related Article

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.