Why the Character of the mysql field is inconsistent with the Charset of the table, and the query with this field will report an error?

  • there is Chinese data in the table today to replace the result that update xxx replace () where desc like"% xxx%" reported an error.
  • then print the show create table xxxx (as shown below. The), desc field is to be stored in Chinese, so the character utf8, is added but the table itself is charset latin1.. (I didn"t build it)

  • descset names xxxx

  • but it"s okay for me to insert data at the foreground, and it"s okay for the command line to use desc as a conditional query. Please give me your advice on why this problem occurs. Is it caused by the difference between character and charset? Then why is it no problem for me to operate at the front desk of web?
Mar.07,2021

desc is the keyword of mysql. When entering a field name from a terminal, you need to use

in backquotes.

such as:

SELECT * FROM your_table where `desc`='';



SELECT * FROM your_table as t where t.desc='';

has nothing to do with the character set.

see
https://dev.mysql.com/doc/ref.

Menu