Modify the default Character Set of mysql in mac to utf8 1 and check the character set of mysql installed by default.
mysql> show variables like '%char%';+--------------------------+--------------------------------------------------------+| Variable_name | Value |+--------------------------+--------------------------------------------------------+| character_set_client | utf8 || character_set_connection | utf8 || character_set_database | latin1 || character_set_filesystem | binary || character_set_results | utf8 || character_set_server | latin1 || character_set_system | utf8 || character_sets_dir | /usr/local/mysql-5.5.23-osx10.6-x86_64/share/charsets/ |+--------------------------+--------------------------------------------------------+8 rows in set (0.00 sec)
Character_set_database and character_set_server are still latin1 character sets. That is to say, the tables created in mysql are latin1 character sets instead of utf8, which may cause some trouble. Therefore, it is necessary to modify my. cnf and shut down the mysql process before modifying my. cnf. Otherwise, the mysql sock cannot be connected. 2. Disable the mysqld background process system preference setting to control mysqld, avoiding the trouble of finding the mysqld installation location. Click Stop MySQL Server
3. Modify the mysql configuration file/etc/my. cnf.
Sudo cp/usr/local/mysql/support-files/my-medium.cnf/etc/my. cnfsudo vi/etc/my. add the cnf [client] Part: default-character-set = utf8 [mysqld] Part: character-set-server = utf8
Exit and save: press ctrl and press the z key twice. Then start mysql 4. Check the result:
Mysql> show variables like '% char % '; + bytes + | Variable_name | Value | + bytes + | character_set_client | utf8 | character_set_connection | utf8 | character_set_database | utf8 | bytes | binary | utf8 | | character_set_server | utf8 | character_set_system | utf8 | character_sets_dir |/usr/local/mysql-5.5.23-osx10.6-x86_64/share/charsets/| + rows + 8 rows in set (0.00 sec) modified #