简体   繁体   English

无法识别数据库中的数据类型nvarchar

[英]Unrecognize data type nvarchar in database

I tried to import MySQL Server data into PHPMyAdmin MySQL database. 我试图将MySQL Server数据导入PHPMyAdmin MySQL数据库。 Unrecognized data type " nvarchar " found. 找不到无法识别的数据类型“ nvarchar ”。 My database collation set to "utf_general_ci". 我的数据库排序规则设置为“utf_general_ci”。

在此输入图像描述

You do not have to worry about the nvarchar message, that was generate by phpmyadmin, not by MySQL. 您不必担心由phpmyadmin生成的nvarchar消息,而不是MySQL。 MySQL does allow nvarchar data type, see MySQL manual on national data character set : MySQL确实允许nvarchar数据类型,请参阅国家数据字符集的 MySQL手册:

Standard SQL defines NCHAR or NATIONAL CHAR as a way to indicate that a CHAR column should use some predefined character set. 标准SQL将NCHAR或NATIONAL CHAR定义为指示CHAR列应使用某些预定义字符集的方法。 MySQL uses utf8 as this predefined character set. MySQL使用utf8作为此预定义字符集。 For example, these data type declarations are equivalent: 例如,这些数据类型声明是等效的:

CHAR(10), CHARACTER SET utf8 NATIONAL CHARACTER(10), NCHAR(10) CHAR(10),CHARACTER SET utf8 NATIONAL CHARACTER(10),NCHAR(10)

As are these: 这些是:

VARCHAR(10), CHARACTER SET utf8 NATIONAL VARCHAR(10), NVARCHAR(10), NCHAR VARCHAR(10), NATIONAL CHARACTER VARYING(10), NATIONAL CHAR VARYING(10) VARCHAR(10),CHARACTER SET utf8 NATIONAL VARCHAR(10),NVARCHAR(10),NCHAR VARCHAR(10),NATIONAL CHARACTER VARYING(10),NATIONAL CHARARY VARYING(10)

The real issue is at the bottom of the error message: row size too large. 真正的问题是在错误消息的底部:行大小太大。 This error message comes from MySQL and that's the one you need to solve. 此错误消息来自MySQL,这是您需要解决的问题。

mysql uses utf8 character set for nvarchar data type. mysql对nvarchar数据类型使用utf8字符集。 An utf8 character in mysql uses up to 3 bytes. mysql中的utf8字符最多使用3个字节。 Your config_data field is defined as nvarchar(21844) , therefore it requires up to 21844*3+2=65534 bytes. 您的config_data字段被定义为nvarchar(21844)因此它最多需要21844 * 3 + 2 = 65534个字节。

As the error message says, a row can be up to 65535 bytes long, so you have 1 byte left, but the other fields push the row size above the limit. 正如错误消息所示,一行最长可达65535字节,因此您还剩1个字节,但其他字段将行大小推到限制之上。

What you can do: 你可以做什么:

  1. Reduce config_data field's length so the overall row length fits into the limit. 减少config_data字段的长度,以使整个行长度符合限制。
  2. Change config_data data type to varchar and use a character set that requires less bytes - just make sure that character set supports all the characters you need. config_data数据类型更改为varchar并使用需要更少字节的字符集 - 只需确保字符集支持您需要的所有字符。
  3. Change config_data data type to text because only a small portion of a text field's value is actually stored in the row itself. config_data数据类型更改为text因为文本字段的值的一小部分实际上存储在行本身中。 This is actually suggested in the error message itself. 这实际上是在错误消息本身中建议的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 JPA Hibernate - 多种数据库方言和 nvarchar(length) 数据类型 - JPA Hibernate - Multiple Database Dialects and nvarchar(length) data type HIVE中MYSQL数据库的nvarchar位适合什么数据类型? - What is appropriate data type for nvarchar, bit of MYSQL database to in HIVE? MySQL数据库无法识别从Excel文件(XLS)中提取的汉字 - MySQL database unrecognize chinese characters extracted from Excel file (xls) 在存储过程中将nvarchar数据类型转换为datetime数据类型 - conversion of a nvarchar data type to a datetime data type in stored procedure 将nvarchar值'undefined'转换为数据类型int时转换失败 - Conversion failed when converting the nvarchar value ' undefined' to data type int MySQL到SQL Server:nvarchar数据类型到日期时间的转换 - MySQL to SQL Server: The conversion of a nvarchar data type to a datetime 我收到错误“将数据类型 nvarchar 转换为实数时出错”。 - I get an error "Error converting data type nvarchar to real." 在数据库中将nvarchar(MAX)更改为nvarchar(n) - Changing nvarchar(MAX) to nvarchar(n) in database MySQL数据库数据类型 - MySQL database data type 将 nvarchar 值 '2151','1886' 转换为数据类型 int 时转换失败 - Conversion failed when converting the nvarchar value '2151','1886' to data type int
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM