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
- 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
- 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
- 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