Home  >  Article  >  Database  >  How to change the encoding to utf-8 in mysql 5.7 under windows

How to change the encoding to utf-8 in mysql 5.7 under windows

零下一度
零下一度Original
2017-06-17 17:33:171297browse

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

Restart mysql


to change the

mysql database

default encoding to utf-8 Many resources on the Internet are added under

[mysqld]


default-character-set=utf8

If this is changed, the 5.7 version of mysql cannot be opened


So change it to


##
character-set-server=utf8


Note:

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn