Mysql version is less than 5.5, modify the encoding method as follows
Add under [client] :
default-character-set=utf8
Add under [mysqld] :
default-character-set=utf8
MySQL version greater than or equal to 5.5 Modify the encoding method as follows
What should be added under [mysqld] should be:
character-set-server=utf8
collation-server=utf8_general_ci