Since MySQL's default encoding is latin1, it is necessary to modify its default encoding format to modify its configuration file.
However, most of the tutorials on the web say that you should copy the Xxx.cnf file under/usr/local/mysql/support-files/to/etc folder and name it my.cnf, and then change the encoding by modifying the MY.CNF configuration file. Most of the way, of course, it works, but it doesn't work on my Mac, and here's how I change it:
1. Directly in the fate of the line through the sudo vi/etc/local/mysql file name/my.cnf, that is, modify the installation directory my.cnf, without the need to copy to/etc path, because at the time of installation, there is no ETC path generates a file similar to MY.CNF, which means that the file under this path is not used when the configuration is read
2. Move the cursor behind [mysqld] and add 3 properties
Default-storage-engine=innodb
Character-set-server=utf8
Collation-server=utf8_general_ci
3. Press the ESC key in the upper-left corner of the keyboard to eject edit mode and enter a colon and letter Wq
4. Restart MySQL service it's that simple.
Change the MySQL encoding format from latin1 to UTF8 under Mac