Teach you a trick to permanently solve the problem of MySQL inserting Chinese characters

Teach you a trick to permanently solve the problem of MySQL inserting Chinese characters

Preface

Problem description:

Incorrect string value:'\xD5\xC5\xC8\xFD' for column 'name' at row 1;

This article uses the modification of configuration files, which can be done in a few minutes. Please back up before modification~~

Some friends will get an error when inserting Chinese into MySQL, so we need to specify the character set.

Use a command to view the character set of the current data~ (Latin when not modified)

show variables like '%character%';

We can have temporary solutions and permanent solutions. Here we only talk about permanent solutions:

To support Chinese, change to utf-8

1. First find the mysql configuration file my.ini

This file contains many mysql configurations, both client and server.

first step:

In this directory:

Right click properties:

Copy the target content to Notepad:

“C:\Program Files\MySQL\MySQL Server 5.7\bin\mysql.exe” “–defaults-file=C:\Program Files\MySQL\MySQL Server 5.7\my.ini” “-uroot” “-p” “–default-character-set=utf8”

This section looks for the target file: C:\Program Files\MySQL\MySQL Server 5.7\my.ini

If this file does not exist, you can check whether it is hidden:

Then find this file

Step 2: Modify this my.ini

Note that when modifying my.ini, you must back up and copy and paste it (this is a good working habit)

Find this location: Change to utf8 (not utf-8)

Change 2:

In mysqld here

Remove the comment and the value will become utf8.

After the modification is completed, save and close it! Finally, you can use the first command to view the same as above picture~~

Summarize

This is the end of this article about permanently solving the problem of Chinese text insertion failure in MySQL. For more relevant content on solving the problem of Chinese text insertion failure in MySQL, please search for previous articles on 123WORDPRESS.COM or continue to browse the related articles below. I hope everyone will support 123WORDPRESS.COM in the future!

You may also be interested in:
  • Solution to the problem that Chinese characters are converted into full question marks when inserted into Mysql???
  • How to solve the problem of Chinese garbled characters when inserting table data into MySQL
  • Five ways to insert Chinese characters into MySQL without garbled characters
  • Solve the problem that MySQL cannot insert Chinese incorrect string value
  • mysql cannot insert Chinese characters
  • Mysql insert Chinese and Chinese query (modification + debugging)

<<:  List of commonly used escape codes for HTML greater than, less than, spaces, quotation marks, etc.

>>:  CSS achieves the effect of aligning multiple elements at both ends in a box

Recommend

Scoring rules of YSlow, a webpage scoring plugin developed by Yahoo

YSlow is a page scoring plug-in developed by Yaho...

VMWare virtual machine 15.X LAN network configuration tutorial diagram

Recently, I have been working on several virtual ...

Markup Language - Image Replacement

Click here to return to the 123WORDPRESS.COM HTML ...

Vue+element implements drop-down menu with local search function example

need: The backend returns an array object, which ...

Use CSS variables to achieve cool and amazing floating effects

Recently, I found a fun hover animation from the ...

A problem with MySQL 5.5 deployment

MySQL deployment Currently, the company deploys M...

Remote development with VSCode and SSH

0. Why do we need remote development? When develo...

A brief discussion on MySQL temporary tables and derived tables

About derived tables When the main query contains...

MySQL 20 high-performance architecture design principles (worth collecting)

Open Source Database Architecture Design Principl...

Discuss the application of mixin in Vue

Mixins provide a very flexible way to distribute ...

Prototype and prototype chain prototype and proto details

Table of contents 1. Prototype 2. Prototype chain...