In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces how to solve the mysql query character set mismatch problem, the article is very detailed, has a certain reference value, interested friends must read it!
Sometimes the MySQL database uses the latin character set when building the table, while the query in the web page is utf-8. When the input page is typed in Chinese, and then queried in the database, it will report the error of ER_CANT_AGGREGATE_2COLLATIONS: Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8_general_ci,COERCIBLE) for operation'=', so the database is found in stackover flow. And the method of changing the character set in the data table.
SET collation_connection = 'utf8_general_ci'
Note: to replace the following two sentences with your database name and your data table name
ALTER DATABASE your_database_name CHARACTER SET utf8 COLLATE utf8_general_ci ALTER TABLE your_table_name CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci
This ensures that the database is also a utf-8 character set, so that there will be no errors in querying the contents of the database when typing in Chinese.
Reference:Illegal mix of collations MySQL Error
Set the character set of the database to utf-8 in PHP
Mysqli_set_charset ($dbc,'utf8')
Just add a meta that displays utf-8 to html.
The above is how to solve the mysql query character set mismatch all the content, thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!
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.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.