【发布时间】:2020-12-02 08:36:07
【问题描述】:
我的旧数据库备份曾经在某些列中包含 UTF-8 字符,但我想它已导出为 latin1 字符集。
现在我对某些包含“西里尔文 (utf8) 字符/文本”的列有疑问:http://prntscr.com/vu4uql
我能够使用以下命令将几列转换为 UTF8 :
UPDATE jos_content SET title = CONVERT(CAST(CONVERT(title USING latin1) AS BINARY) USING utf8);
列:“title”、“introtext”现在已转换并显示“Cyrillic (utf8) characters/text”
但我只有一列“全文”有问题,当我尝试在 SQL > phpmyadmin 中使用上述命令时,我收到以下错误:
Error
Static analysis:
18 errors were found during analysis.
Unrecognized keyword. (near "fulltext" at position 23)
Unexpected token. (near "=" at position 32)
Unrecognized keyword. (near "CONVERT" at position 34)
Unexpected token. (near "(" at position 41)
Unrecognized keyword. (near "CAST" at position 42)
Unexpected token. (near "(" at position 46)
Unrecognized keyword. (near "CONVERT" at position 47)
Unexpected token. (near "(" at position 54)
Unrecognized keyword. (near "fulltext" at position 55)
Unrecognized keyword. (near "USING" at position 64)
Unexpected token. (near "latin1" at position 70)
Unexpected token. (near ")" at position 76)
Unrecognized keyword. (near "AS" at position 78)
Unrecognized keyword. (near "BINARY" at position 81)
Unexpected token. (near ")" at position 87)
Unrecognized keyword. (near "USING" at position 89)
Unexpected token. (near "utf8" at position 95)
Unexpected token. (near ")" at position 99)
SQL query:
UPDATE jos_content SET fulltext = CONVERT(CAST(CONVERT(fulltext USING latin1) AS BINARY) USING utf8)
MySQL said: Documentation
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'fulltext = CONVERT(CAST(CONVERT(fulltext USING latin1) AS BINARY) USING utf8)' at line 1
我怎样才能修复/将此列转换为上一列?
【问题讨论】:
标签: mysql phpmyadmin