Mysql服务器不支持4字节编码的utf8字符

发布于 2024-08-14 22:09:44 字数 241 浏览 10 评论 0原文

我在运行从 Sql Server 到 MySql db 的数据传输组件时收到服务器错误。 错误消息如下:

<代码> [MySql][ODBC 5.1 驱动程序][mysqld-5.0.67-community-nt-log]服务器不支持 4 字节编码的 UTF8 字符。

源 Sql Server 表包含 nvarchar 列,目标 MySql 表包含 varchar 列。

有人能解释一下这个问题吗?

I've received a server error running a Data transfer component from Sql Server to MySql db.
The error message reads as follows:


[MySql][ODBC 5.1 Driver][mysqld-5.0.67-community-nt-log]Server does not support 4-byte encoded UTF8 characters.

The source Sql Server table contains nvarchar columns, the target MySql table contains varchar columns.

Can anybody shed some light on this problem?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(8

梦冥 2024-08-21 22:09:44

如果需要MySQL支持4字节UTF-8字符(通常被认为是UTF-8的一部分),则需要使用字符集utf8mb4,而不是utf8。 MySQL 5.5.3 首次支持 utf8mb4。

If you need MySQL to support 4-byte UTF-8 characters (which is normally considered part of UTF-8), you need to use the character set utf8mb4, not utf8. utf8mb4 was first supported in MySQL 5.5.3.

櫻之舞 2024-08-21 22:09:44

“4字节编码的UTF-8字符”是指代码点>的字符。 0xFFFF,即代码点不适合 16 位(在基本多语言平面 (BMP) 之外)。许多旧系统不支持 BMP 之外的字符。

BMP 之外的字符通常是 CJK 字符;不知道你这里是不是也是这样。 :-)

"4-byte encoded UTF-8 characters" refers to characters with code point > 0xFFFF, i.e., ones whose code points don't fit within 16 bits (are outside the basic multilingual plane (BMP)). Many older systems don't support characters outside the BMP.

Characters outside the BMP are usually CJK characters; I don't know if that's the case with you here. :-)

柠栀 2024-08-21 22:09:44

我遇到了同样的问题,只需将 SQL 2008 上的链接服务器上的单行的 char(1) 列更新为 MySQL 5.1 数据库即可重现该问题:

update linked_server_name...table_name set status = 'c' where id = 1;

此错误发生在新建的数据库上服务器。我在另一台机器上有类似的设置,相同的代码运行得很好。唯一的区别是 MySQL ODBC 驱动程序的版本:在新服务器上,它是 5.2.2;在新服务器上,它是 5.2.2。在旧(工作)服务器上,它是 5.1.8(现在不受支持)。

我下载并安装了以前版本的 ODBC 驱动程序 (v5.1.11),问题就消失了。

I had the same problem which I could reproduce by simply updating a char(1) column for a single row over a linked server on SQL 2008 to a MySQL 5.1 DB:

update linked_server_name...table_name set status = 'c' where id = 1;

This error was occurring on a newly built server. I had a similar setup on another machine, where the same code worked just fine. The only difference was the version of the MySQL ODBC driver: on the new server, it was 5.2.2; on the old (working) server, it's 5.1.8 (now unsupported).

I downloaded and installed the previous version of the ODBC driver (v5.1.11), and the problem went away.

傲世九天 2024-08-21 22:09:44

来自文档

目前,MySQL 支持 UTF-8
不包括四字节序列。
(UTF-8 编码的较旧标准
由 RFC 2279 给出,它描述了
UTF-8 序列从 1 到
六个字节。 RFC 3629 呈现 RFC 2279
过时的;由于这个原因,序列
不再有五个和六个字节
使用过。)

From the documentation:

Currently, MySQL support for UTF-8
does not include four-byte sequences.
(An older standard for UTF-8 encoding
is given by RFC 2279, which describes
UTF-8 sequences that take from one to
six bytes. RFC 3629 renders RFC 2279
obsolete; for this reason, sequences
with five and six bytes are no longer
used.)

转角预定愛 2024-08-21 22:09:44
  1. 将 MySQL 更新到 5.5.3 并使用 utf8mb4 进行列编码。

  2. 强制复制

  3. 在 SQLServer 中创建一个与您需要复制的表结构相同的新表

  4. 更改新表的列 nvarchar(size) -> varchar(size x 2)

  5. 将数据复制到新表中

  6. 将 SQLServer 的数据从新表复制到 MySQL

  1. Update your MySQL to 5.5.3 and use utf8mb4 for column encoding.

  2. Force copy

  3. Create a new table in SQLServer with the same structure as the table you need to copy

  4. Change the new table's column nvarchar(size) -> varchar(size x 2)

  5. Copy the data into the new table

  6. Copy the SQLServer's data from the new table to MySQL

如若梦似彩虹 2024-08-21 22:09:44

遇到同样的问题。是否可以在插入mysql数据库之前转换字符?

我在远程 Web 服务器上有一个 MySQL 数据库,没什么特别的。现在,我使用 ODBC 驱动程序将远程 MySQL 数据库与本地 MS SQL Server 2008 连接。这效果很好,但是当我尝试从 MSSQL 插入字符串值时,会发生错误。对于数字(int)它效果很好。

语法看起来像

INSERT INTO OPENQUERY(
   MYSQL, 
   'SELECT Adresse, Mandant, Matchcode FROM   usr_p171552_2.Adressen' 
) SELECT Adresse, Mandant, Matchcode FROM Adressen

好的。

我正在寻找类似的东西

INSERT INTO OPENQUERY(
    MYSQL, 
    'SELECT Adresse, Mandant, Matchcode FROM usr_p171552_2.KHKAdressen' 
) SELECT Adresse, Mandant, Matchcode FROM KHKAdressen CONVERTTOCHARSET compatiblecharset

Got the same problem. Is it possible to convert the chars before insert into mysql database?

I've got a MySQL database on a remote web server, nothing special. Now I'm using a ODBC Driver to connect the remote MySQL Database with my local MS SQL Server 2008. This works great, but when I'm trying to insert string values from MSSQL, the error occurs. With numbers (int) it works great.

Syntax looks like

INSERT INTO OPENQUERY(
   MYSQL, 
   'SELECT Adresse, Mandant, Matchcode FROM   usr_p171552_2.Adressen' 
) SELECT Adresse, Mandant, Matchcode FROM Adressen

Okay.

I'm look for something like

INSERT INTO OPENQUERY(
    MYSQL, 
    'SELECT Adresse, Mandant, Matchcode FROM usr_p171552_2.KHKAdressen' 
) SELECT Adresse, Mandant, Matchcode FROM KHKAdressen CONVERTTOCHARSET compatiblecharset
所谓喜欢 2024-08-21 22:09:44

它看起来像是一个已知的错误。这是关于 MySQL 错误的问题。

http://bugs.mysql.com/bug.php?id=67428

It looks like a known bug. Here is the issue on MySQL bugs.

http://bugs.mysql.com/bug.php?id=67428

街角迷惘 2024-08-21 22:09:44

我在 1 台客户端计算机建立 ODBC 连接以将数据拉入 Excel 电子表格时收到此错误消息。其他几台机器可以毫无问题地更新同一个电子表格。

经过一番搜索,我什么也没找到,于是开始尝试。 ODBC 连接是使用 MySQL unicode 驱动程序设置的。我使用 ANSI 驱动程序重新创建了连接,并且工作正常。

希望这对其他人有帮助。

I was getting this error message with 1 client machine making an ODBC connection to pull data into an excel spreadsheet. Several other machines could update this same spreadsheet with no trouble.

After a bit of searching, I found nothing, so started experimenting. The ODBC connection was setup with the MySQL unicode driver. I recreated the connection using the ANSI driver and it works fine.

Hope this helps someone else.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文