The default encoding of mysql is Latin (latin1). When inputting Chinese, an error will be reported, so the encoding needs to be changed to utf8. I can’t find relevant tutorials on the Internet. I simply explored it myself and shared it with everyone. The following is This article mainly introduces the steps of how to modify the encoding to utf-8 in mysql version 5.7. Friends in need can refer to it.
Preface
I just started learning MySQL. I downloaded the latest version 5.7.14 from the official website. When I used cmd to input Chinese, I got an error, so I started to modify it. MySQL default encoding (under Windows), let’s take a look at the detailed modification method.
The method is as follows
First passshow variables like 'character_set_%';
Viewmysql Character set情
The default encoding is latin1
Then close the database
In the mysqlinstallation directory Find the my.ini file under
and add
[client] default-character-set=utf8
under [mysqld]
.
##
character-set-server=utf8
to change the
default encoding to utf-8 Many resources on the Internet are added under
[mysqld]default-character-set=utf8
So change it to
character-set-server=utf8
After changing, you need to Delete all data in the database before it can be used.
The above is the detailed content of How to change the encoding to utf-8 in mysql 5.7 under windows. For more information, please follow other related articles on the PHP Chinese website!