How to solve the problem of MySQL character set error
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!