Mysql inserts Chinese Characters in mac to solve the problem. macmysql
After several hours, I finally got it done.
The root cause of garbled characters is the differences in encoding methods. As long as the encoding methods are unified, there is no problem.
1. Enter the mysql command line and use show variables like 'character _ set _ % '; to view the Encoding
| 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
Make sure all encoding methods are utf8.
2. If it is not utf8, perform the following operations:
Stop mysql service first: sudo/Library/StartupItems/MySQLCOM stop
Copy any *. cnf under/usr/local/mysql/support-files to/etc/my. cnf and add the following configuration
[Mysqld]
Character-set-server = utf8
[Client]
Default-character-set = utf8
3. Restart mysql: sudo/Library/StartupItems/MySQLCOM start
4. Create a new database and table.