SoFunction
Updated on 2025-03-08

Steps to modify the method encoding to utf-8 in mysql version 5.7 under Windows

Preface

I just started learning MySQL and downloaded the latest version of the official website, 5.7.14. I reported an error when I entered Chinese using cmd, so I started to modify the default encoding of mysql (under Windows). Let’s take a look at the detailed modification method below.

The method is as follows

First passshow variables like 'character_set_%';View mysql character set

The default encoding is latin1

Then close the database

Find the file in the mysql installation directory

Add it

[client]
default-character-set=utf8

exist[mysqld]Add

character-set-server=utf8

Restart mysql

You can change the default encoding of mysql database to utf-8

Many resources are available on the Internet[mysqld]Add

default-character-set=utf8

If this changes, the 5.7 version of mysql will not be opened

So change it

character-set-server=utf8

Notice:After the modification, you must delete all data in the database before you can use it.

Summarize

The above is the entire content of this article. I hope the content of this article will be of some help to your study or work. If you have any questions, you can leave a message to communicate. Thank you for your support.