mysql5.6 character set settings under Mac

Source: Internet
Author: User
Tags mysql command line

http://geeksblog.cc/2016/05/28/mac-mysql-unicode/

mac under mysql5.6 character set:
A pit that has been trampled when setting the mysql5.6 character set under Mac, guaranteed to be effective

Why set character Sets
    1. Set character sets are mainly to solve garbled problems, due to different Chinese and English coding results, Chinese garbled, so generally set to UTF8 format
    2. Different character sets and encodings consume different bytes, choosing the appropriate encoding improves database performance
Settings under Mac
    • In the/etc/my.cnf file settings, if no this file can be copied from/usr/local/mysql/support-files/, the command is as follows
      1
      2
      cd/usr/local/mysql/support-Files
      CP My. cnf/etc/my. CNF

View Read and Write permissions for a file if 644 (rw-r–r–) is changed to (664) (rw-rw-r–)
If you change to (666) (rw-rw-rw-), the configuration file will not take effect

1
664/etc/my.cnf

  • The MY.CNF settings are as follows:
    1
    2
    3
    4
    5
    6
    7
    8
    [Client]
    default-character-Set=utf8
    [Mysqld]
    collation-Server = Utf8_unicode_ci
    init-connect=' SET NAMES UTF8 '
    character-set-server = UTF8
    [MySQL]
    default-character-Set=utf8
To see if the settings were successful

Enter MySQL at the command line, if prompted without a command, in bash or zsh files, I use zsh, set ~/.ZSHRC,

1
2
Export mysql="/usr/local/mysql/bin/"
Export path="/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:$MYSQL"

Enter MySQL at the command line, enter the MySQL command line, status; orshow variables like ‘%char%‘;

1
2
3
4
5
6
7
8
|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 |
| Character_sets_dir | /usr/local/mysql-5.6.30-osx10.11-x86_64/share/charsets/

If the article is helpful to you, please leave a message on my blog! My blog

mysql5.6 character set settings under Mac

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.