Mysql服务器不支持4字节编码的utf8字符
我在运行从 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(8)
如果需要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.
“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. :-)
我遇到了同样的问题,只需将 SQL 2008 上的链接服务器上的单行的
char(1)
列更新为 MySQL 5.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: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.
来自文档:
From the documentation:
将 MySQL 更新到 5.5.3 并使用 utf8mb4 进行列编码。
强制复制
在 SQLServer 中创建一个与您需要复制的表结构相同的新表
更改新表的列 nvarchar(size) -> varchar(size x 2)
将数据复制到新表中
将 SQLServer 的数据从新表复制到 MySQL
Update your MySQL to 5.5.3 and use utf8mb4 for column encoding.
Force copy
Create a new table in SQLServer with the same structure as the table you need to copy
Change the new table's column nvarchar(size) -> varchar(size x 2)
Copy the data into the new table
Copy the SQLServer's data from the new table to MySQL
遇到同样的问题。是否可以在插入mysql数据库之前转换字符?
我在远程 Web 服务器上有一个 MySQL 数据库,没什么特别的。现在,我使用 ODBC 驱动程序将远程 MySQL 数据库与本地 MS SQL Server 2008 连接。这效果很好,但是当我尝试从 MSSQL 插入字符串值时,会发生错误。对于数字(int)它效果很好。
语法看起来像
好的。
我正在寻找类似的东西
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
Okay.
I'm look for something like
它看起来像是一个已知的错误。这是关于 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
我在 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.