Solution to the problem that MySQL in Windows system cannot input and display Chinese

Solution to the problem that MySQL in Windows system cannot input and display Chinese

Step 1: Use Notepad to open the "my.ini" file in the MySQL installation directory.

# MySQL client library initialization.
[client]
port=3306
[mysql]
default-character-set=utf8

Check if default-character-set is utf8, if not, just change it to utf8! (Previous versions may not have this sentence, so just add it!)

Step 2: Enter in the MySQL database cmd: show variables like'%char% ';

This is what it looks like after successful setup.

Step 3:

set character_set_database=utf8;
set character_set_server=utf8;
set character_set_client=gbk;
set character_set_connection=gbk;

This is the configuration to insert Chinese characters. You must enter these commands in cmd to run mysql.

Step 4:

set character_set_results=gbk

This is the configuration to display Chinese. Done

Next, I will share a graphic operation method

#Solve the problem that mysql cannot input Chinese characters

Modify the mysql character set and modify the configuration file my.ini
character_set_server = utf8
Centered image:

insert image description here 2.

We have already established the database, and now we also need to change the database character set in Navicat for MySQL. Right-click the database and select Database Properties, as shown in the figure. After entering, change the character set to utf8

insert image description here 3. You also need to right-click each table and select the involved table;

Then in "Options", modify the character set of the table.

insert image description here 4.

Enter the design table, click on a field, and find that the data type is still Latin1. OK, just change it one by one.

insert image description here
5. It’s done perfectly, you can try it now.

Summarize

The above is the solution to the problem that MySQL on the window system cannot input or display Chinese. I hope it will be helpful to everyone. If you have any questions, please leave me a message and I will reply to you in time!

You may also be interested in:
  • How to solve the problem of garbled Chinese characters displayed in the MySQL client output window
  • mysql odbc character set setting (Chinese characters are displayed in garbled characters)
  • MySQL cannot display Chinese and its solution

<<:  Nginx merges request connections and speeds up website access examples

>>:  Writing Snake Game with Native JS

Recommend

JS removeAttribute() method to delete an attribute of an element

In JavaScript, use the removeAttribute() method o...

Canvas draws scratch card effect

This article shares the specific code for drawing...

The perfect solution for forgetting the password in mysql8.0.19

Recommended reading: MySQL 8.0.19 supports accoun...

How to get USB scanner data using js

This article shares the specific process of js ob...

How to track users with JS

Table of contents 1. Synchronous AJAX 2. Asynchro...

Code analysis of synchronous and asynchronous setState issues in React

React originated as an internal project at Facebo...

Linux editing start, stop and restart springboot jar package script example

Preface In the springboot configuration file, the...

Detailed usage of Vue timer

This article example shares the specific code of ...

Each time Docker starts a container, the IP and hosts specified operations

Preface Every time you use Docker to start a Hado...

Randomly generate an eight-digit discount code and save it to the MySQL database

Currently, many businesses are conducting promoti...

Example code for CSS pseudo-classes to modify input selection style

Note: This table is quoted from the W3School tuto...

Detailed example of inserting custom HTML records in Quill editor

It is already 2020. Hungry humans are no longer s...

ReactHooks batch update state and get route parameters example analysis

Table of contents 1. How to update in batches Con...