How to change mysql default encoding to UTF8
The method of changing the default encoding of mysql to UTF8: first add [default-character-set=utf8] in the client field; then add [character-set-server=utf8] in the mysqld field; finally restart The mysql service takes effect. Related learning recommendation: mysql tutorial The method of changing the default encoding of mysql to UTF8 : windows: a. WIN+R net stop mysql close mysql service b. Copy my -dafault.ini, renamed to my.ini, enter it UBUNTU: ** sudo vim /etc/mysql/my.cnf **Enter Perform the following operations: 1. In [client ] field, add default-character-set=utf8, as follows: [client] port = 3306 socket = /var/lib/mysql/mysql.sock default-character-set=utf8 2. Add character-set-server=utf8 in the [mysqld] field, as follows: [mysqld] port = 3306 socket = /var/lib/mysql/mysql.sock character-set-server=utf8 3. Add default-character-set=utf8 in the [mysql] field, as follows: [mysql] no-auto-rehash default-character-set=utf8 After the modification is completed, service mysql restart will take effect after restarting the mysql service. Note: There is a difference between the [mysqld] field and the [mysql] field. No one has reported this on the Internet. Note: show variables like 'character%' can view the mysql encoding method, after the modification is completed, it looks like this: +————————–+—– ———————–+ | Variable_name | Value | +————————–+———————- ——+ | character_set_client | utf8 | | character_set_connection | utf8 | |…