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

零下一度
Release: 2017-06-17 17:33:17
Original
1262 people have browsed it

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 mysqlinstallationdirectory Find the my.ini file under

and add


[client] default-character-set=utf8
Copy after login

under[mysqld].

##

character-set-server=utf8
Copy after login
Copy after login

Restart mysql


to change the

mysql database

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

[mysqld]


default-character-set=utf8
Copy after login

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


So change it to


##
character-set-server=utf8
Copy after login
Copy after login


Note:

After changing, you need toDelete all data in thedatabase 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!

Related labels:
source:php.cn
Statement of this Website
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
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!