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 MySQL character set error

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly explains "how to solve the problem of MySQL character set error". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn how to solve the problem of MySQL character set error.

An example explains the solution to the error in MySQL character set: the error is as follows:

Illegal mix of collations (gbk_chinese_ci,IMPLICIT) and (gbk_bin,IMPLICIT) for operation'=', SQL State: HY000, Error Code: 1267

Cause of error:

The coding of the database is different from that when the table is created.

Treatment method:

If you set the encoding to jbk when you install MySQL, you can do the following when creating the table:

CREATE TABLE `teachers` (`id` int (11) NOT NULL default '0mm, `name` varchar (20) default NULL, `password` varchar (20) default NULL, `department_ id` int (11) default NULL, PRIMARY KEY (`id`) ENGINE=MyISAM DEFAULT CHARSET=gbk

Or:

CREATE TABLE `teachers` (`id` int (11) NOT NULL default '0mm, `name` varchar (20) default NULL, `password` varchar (20) default NULL, `password` int (11) default NULL, PRIMARY KEY (`id`)). Now that you have a better understanding of "how to solve the problem of MySQL character set error", you might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

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

Database

Wechat

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

12
Report