C # program connects to MySQL, reported "illegal mix of collations (utf8_general_ci,implicit) and (utf8_unicode_ci,implicit) for operation ' = '" Solutions for

Source: Internet
Author: User

===============================================

20170607_ for the first time modified ccb_warlock

===============================================

Working relationships develop a C # program that connects to MySQL, delivering tests that respond to errors after a database is connected to a test environment and where data is not available. (as shown)

After I found http://www.cnblogs.com/xiaochaohuashengmi/archive/2010/07/23/1783589.html, I realized that it might be the encoding of the field in the table (the collation of the field in Navicat ) is inconsistent with the coding of the associated table field, which causes the error.

According to this idea, set a breakpoint to find the query SQL, check the test environment in the field code of these tables, and sure enough, the field encoding of one of the tables is inconsistent with the other table, the use is utf8_unicode_ci (the other table design encoding is UTF8_GENERAL_CI).

Test environment The table's encoding diagram

I borrowed a development environment when I debugged, so is there a difference in the coding of this table in the development and test environment? Then we looked at the configuration of the development environment, and there was a difference.

Development environment The table's encoding diagram

Speculation is that the development environment has changed the table coding rules have not been updated to the test environment, so the test environment of the table coding and development environment differences, resulting in the development environment debugging normal, but in the test environment debugging error.

Even if the day has been sublimated, I hope beginner's mind not.

----------Ccb_warlock

C # program connects to MySQL, reported "illegal mix of collations (utf8_general_ci,implicit) and (utf8_unicode_ci,implicit) for operation ' = '" Solutions for

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.