Method and steps for modifying code to utf 8 in version 5.7 of mysql under windows
- 2021-08-12 03:55:56
- OfStack
Preface
I just started to learn MySQL, downloaded the latest version 5.7. 14 of official website, and made mistakes when entering Chinese with cmd, so I started to modify the default code of mysql (under windows). Let's take a look at the detailed modification method.
The method is as follows
Pass first
show variables like 'character_set_%';
View the mysql Character Set
The default code is latin1
Then close the database
Locate the my. ini file in the mysql installation directory
Add in it
[client]
default-character-set=utf8
In
[mysqld]
Add under
character-set-server=utf8
Restart mysql
You can change the default encoding of the mysql database to utf-8
Many resources on the Internet are in
[mysqld]
Add under
default-character-set=utf8
This change will cause the 5.7 mysql to fail to open
So it should be changed to
character-set-server=utf8
Note: After the change, you should delete all the data in the database before you can use it.
Summarize