Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to solve the problem of Incorrect string value in Mysql

2025-02-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

How to solve the problem of Incorrect string value in Mysql, many novices are not very clear about this, in order to help you solve this problem, the following editor will explain in detail for you, people with this need can come to learn, I hope you can gain something.

Many friends will report the following error when inserting Chinese characters using mysql:

This is because we do not specify a character set, the storage of characters in the computer is represented by a two-tier system, and similarly, Chinese characters need to be stored in binary, so we need to specify a table (representation rules: what Chinese characters correspond to what binary). Generally speaking, utf8 is commonly used. Of course, you can also specify utf8mb4, which can be used to represent more special symbols, such as facial expressions, but it is sufficient to use utf8 in our daily use. Let's take specifying the character set of utf8 as an example:

First find the Mysql program in the start menu:

Just right-click either of these two, and then click more-Open File location:

Also right-click any one of them, and then click Properties to find the path corresponding to my.ini in the target path:

Then right-click my.ini to open it in notepad

Write utf8 after the equal sign under [mysql]

Similarly, add utf8 to the right of the equal sign under [mysqld] (note that there can be no spaces on both sides)

Pay special attention!

1. Delete the pound sign in front of these two statements after adding utf8 to prevent it from being mistaken for comments by the system!

two。 If you are afraid to correct your mistakes before you modify them, you can make a backup copy of my.ini (copy and paste) in advance.

After the modification, we can restart the computer, so that there will be no errors when adding Chinese characters in the future. (note here, before modification, we will still report errors when inserting Chinese characters into the original database. We should create a new database)

Is it helpful for you to read the above content? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report