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

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

Preface

I just started learning MySQL and downloaded the latest version 5.7.14 from the official website. When I used cmd to enter Chinese, an error occurred, so I started to modify the MySQL default encoding (under Windows). Let's take a look at the detailed modification method.

Here’s how

First, view the MySQL character set information by show variables like 'character_set_%';

The default encoding is latin1

Then close the database

Find the my.ini file in the mysql installation directory

Add it

[client]
default-character-set=utf8

Add under [mysqld]

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 added under [mysqld]

default-character-set=utf8

If this change is made, the 5.7 version of MySQL will not be able to open

So change it to

character-set-server=utf8

Note: After the modification, all data in the database must be deleted before it can be used.

Summarize

The above is the full content of this article. I hope that the content of this article can bring some help to your study or work. If you have any questions, you can leave a message to communicate. Thank you for your support of 123WORDPRESS.COM.

You may also be interested in:
  • Modify the default encoding of MySQL 5.5 (change the graphic steps to utf-8 encoding)
  • Solution to garbled characters when using UTF-8 Chinese encoding in MYSQL database
  • MySQL GBK → UTF-8 encoding conversion
  • The default encoding of mysql is UTF-8. You can modify my.ini to achieve this.
  • PHP page, MySQL database conversion to utf-8 garbled code, utf-8 encoding problem summary
  • Python MySQLdb inserts Chinese data using utf-8 encoding
  • Why not use UTF-8 encoding in MySQL?

<<:  Get / delete method to pass array parameters in Vue

>>:  Creating Responsive Emails with Vue.js and MJML

Recommend

How to authorize remote connections in MySQL in Linux

Note: Other machines (IP) cannot connect to the M...

The difference and usage of distinct and row_number() over() in SQL

1 Introduction When we write SQL statements to op...

...

Mysql uses stored procedures to quickly add millions of data sample code

Preface In order to reflect the difference betwee...

Detailed explanation of CSS counter related attributes learning

The CSS counter attribute is supported by almost ...

MySQL replication advantages and principles explained in detail

Replication is to transfer the DDL and DML operat...

Why the table file size remains unchanged after deleting data in MySQL

For databases that have been running for a long t...

html base url tag

Its function is to set a global style. Then your s...

Implementation of socket options in Linux network programming

Socket option function Function: Methods used to ...

mysql zip file installation tutorial

This article shares the specific method of instal...

Vue custom components use event modifiers to step on the pit record

Preface Today, when I was using a self-written co...

HTML left, center, right adaptive layout (using calc css expression)

In the latest HTML standard, there is a calc CSS e...

How to upload and download files between Linux server and Windows system

Background: Linux server file upload and download...