当前位置:网站首页>MySQL insert Chinese error
MySQL insert Chinese error
2022-06-26 08:11:00 【Painted horse】
Mysql Error inserting Chinese
Inserting Chinese will report an error , But there will be no error when inserting English .
error analysis : Maybe the encoding format is not utf8 Caused by the .
![[ Failed to transfer the external chain picture , The origin station may have anti-theft chain mechanism , It is suggested to save the pictures and upload them directly (img-kwDenRxS-1633451209914)(D:\ desktop \ note \mysql\ picture \image-20211005234303144.png)]](/img/f6/a443288da9e0d63af91cd8b685d779.jpg)
terms of settlement : Modify encoding format
![[ Failed to transfer the external chain picture , The origin station may have anti-theft chain mechanism , It is suggested to save the pictures and upload them directly (img-vgHoRz1W-1633451209915)(D:\ desktop \ note \mysql\ picture \image-20211005234522794.png)]](/img/c0/2378f60770949e79bcec84c1f90d20.jpg)
Modify the encoding format of the character set and the encoding format of the arrangement order : As shown in the figure below
![[ Failed to transfer the external chain picture , The origin station may have anti-theft chain mechanism , It is suggested to save the pictures and upload them directly (img-Z4CB5w4g-1633451209915)(D:\ desktop \ note \mysql\ picture \image-20211005234701172.png)]](/img/ad/c18af789842b7efc26b464776df4f8.jpg)
After modification, test and insert Chinese . If not, modify the database coding format
![[ Failed to transfer the external chain picture , The origin station may have anti-theft chain mechanism , It is suggested to save the pictures and upload them directly (img-Dmnfqt6f-1633451209916)(D:\ desktop \ note \mysql\ picture \image-20211005235230399.png)]](/img/b1/7e7a54a6e380ba8f8116a6f238a6fd.jpg)
It is amended as follows :

After revising , If the test finds that it doesn't work Open the command line interface : Input show create table user;
![[ Failed to transfer the external chain picture , The origin station may have anti-theft chain mechanism , It is suggested to save the pictures and upload them directly (img-ZBZI79xl-1633451209918)(D:\ desktop \ note \mysql\ picture \image-20211005235142459.png)]](/img/91/ad3f44fcb17057a411c68925e4c197.jpg)
Find out name and email The encoding format of is latin1 No utf8, But the default encoding format has changed to utf8 了
Therefore, you need to modify the coding format of the corresponding column
Use the following command to modify user The coding format in the table
![[ Failed to transfer the external chain picture , The origin station may have anti-theft chain mechanism , It is suggested to save the pictures and upload them directly (img-MOT1tVI0-1633451209918)(D:\ desktop \ note \mysql\ picture \image-20211006000748710.png)]](/img/26/42259709358707373e55039989a7a5.jpg)
View after modification user Table coding format . I found that I didn't do what you just did latin1 了 . Test it again
![[ Failed to transfer the external chain picture , The origin station may have anti-theft chain mechanism , It is suggested to save the pictures and upload them directly (img-h7aaKLAp-1633451209918)(D:\ desktop \ note \mysql\ picture \image-20211006000836208.png)]](/img/99/5b92f5eb04110dbd5f9f12f796981b.jpg)
test result :
![[ Failed to transfer the external chain picture , The origin station may have anti-theft chain mechanism , It is suggested to save the pictures and upload them directly (img-jYJyH4sx-1633451209919)(D:\ desktop \ note \mysql\ picture \image-20211006000935037.png)]](/img/c5/1d4865db53714e379c8e1d67a73d30.jpg)
Successfully inserted Chinese .
remarks
After modifying the encoding format, you need to restart mysql database
Restart command :MySQL
net stop mysql Service name of
net start mysql Service name of
appendix :
mysql Modify the coding format of database tables and fields in tables
Modify the coding format of all fields in a table
alter table tablename convert to character set utf8;
Change the encoding format of the table
ALTER TABLE tablename DEFAULT CHARACTER SET utf8;
Modify the encoding format of the field
ALTER TABLE tablename CHANGE Field name 1 Field name 2 VARCHAR(36) CHARACTER SET utf8 NOT NULL;
CHANGE Field name 1 Field name 2 VARCHAR(36) CHARACTER SET utf8 NOT NULL;
边栏推荐
- Software engineering - high cohesion and low coupling
- Mapping '/var/mobile/Library/Caches/com.apple.keyboards/images/tmp.gcyBAl37' failed: 'Invalid argume
- . eslintrc. JS configuration
- 2: String insert
- Database learning notes I
- MySQL practice: 2 Table definition and SQL classification
- What are the characteristics of digital factory in construction industry
- 4 best practices for wireless (OTA) updates
- Go language shallow copy and deep copy
- Detailed explanation and code implementation of soft voting and hard voting mechanism in integrated learning
猜你喜欢

Chapter VI (pointer)

MySQL practice: 4 Operation of data

Oracle 19C download installation steps

Junit

Double linked list -- tail interpolation construction (C language)

Go语言浅拷贝与深拷贝

Uploading pictures with FileReader object

How to define a digital factory and what is the relationship with smart factory and industry 4.0

Flume learning notes

Ping An technology's practice of migrating from Oracle to ubisql
随机推荐
StarWar armor combined with scanning target location
How to define a digital factory and what is the relationship with smart factory and industry 4.0
CodeBlocks集成Objective-C开发
Interview ES6
Google Earth Engine(GEE) 01-中输入提示快捷键Ctrl+space无法使用的问题
Detach an entity from jpa/ejb3 persistence context
Delete dictionary from list
Detailed explanation of the generate go file command of import in golang (absolute detail)
I want to open a stock account at a discount. How do I do it? Is it safe to open a mobile account?
Use middleware to record slow laravel requests
Read excel table and render with FileReader object
你为什么会浮躁
Interview JS and browser
Which securities company has the lowest Commission for opening a mobile account? Is it safe to open an account online?
Golang collaboration and channel usage
Gavin teacher's insight on transformer live class - multi state transition of financial BOT and rasa interactive behavior analysis of Rasa project (52)
Chapter 5 (array)
MySQL practice: 3 Table operation
Two models of OSPF planning: double tower Raider and dog tooth crisscross
Project practice: parameters of pycharm configuration for credit card digital recognition and how to use opencv in Anaconda