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.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e548b7-44237.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e548b7-44237.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?