Method: 1. Open the "my.ini" file and add "default-character-set=utf8" under client; 2. Add "default-character-set=utf8" under mysql; 3. Just modify the contents of mysqld and then restart it.
The operating environment of this tutorial: windows10 system, mysql8.0.22 version, Dell G3 computer.
Modify the MySQL configuration file
Find the my.ini file
After entering it, add configurations in three places.
First one:
[client] default-character-set=utf8
Second one:
[mysql] default-character-set=utf8
Third one:
[mysqld] character-set-client-handshake = FALSE character-set-server = utf8 collation-server = utf8_unicode_ci init_connect='SET NAMES utf8'
Restart MySQL service
This computer——>Management——>Services and Applications——>Service——>mysql service——>Restart
Enter the command
show variables like '%char%';
to view the mysql character set
## Recommended learning:The above is the detailed content of How to modify the character set of a field in mysql. For more information, please follow other related articles on the PHP Chinese website!