Mysql encoding problem resolution record in mac

Source: Internet
Author: User

Mysql encoding problem resolution record in mac

When I used mysql, I was inexplicably unable to insert it into Chinese. Although I knew it was a coding problem, it took a long time to solve it. I will record it here.

1. Change the mysql program encoding:

Mysql encoding modification, Linux/Mac/Unix/General mysql encoding modification requires the myslq configuration file, which is in/etc/my. cnf, mac users do not have this file by default. You can find any my-*** In the mysql installation directory/support-files -***. copy cnf to/ect. copy it and change it to my. cnf! Then add default-character-set = utf8 under [client] and add the following three lines under [mysqld: default-storage-engine = INNODB character-set-server = utf8 collation-server = utf8_general_ci and above can ensure the utf_8 encoding in the program, but there may still be problems and Chinese characters cannot be inserted. 2. view the database encoding, in workbench to re-Modify to utf-8-general-ci, may still not work. 3. Look at the specific data table, look at the collection attribute of varchar (), generally latin1, modify this to the utf-8-general-ci, perfect solution to the problem.

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.