9.2.1 Identifier Length Limits标识符长度限制

The following table describes the maximum length for each type of identifier.下表描述了每种类型标识符的最大长度。

Identifier Type标识符类型Maximum Length (characters)最大长度(字符)
Database数据库64 (includes NDB Cluster 8.0.18 and later)(包括NDB集群8.0.18及更高版本)
Table64 (includes NDB Cluster 8.0.18 and later)(包括NDB集群8.0.18及更高版本)
Column64
Index索引64
Constraint约束64
Stored Program存储的程序64
View视图64
Tablespace表空间64
Server服务器64
Log File Group日志文件组64
Alias别名256 (see exception following table)(见下表中的例外情况)
Compound Statement Label复合语句标签16
User-Defined Variable用户定义变量64
Resource Group资源组64

Aliases for column names in CREATE VIEW statements are checked against the maximum column length of 64 characters (not the maximum alias length of 256 characters).CREATE VIEW语句中列名的别名是根据最大列长度64个字符(而不是最大别名长度256个字符)进行检查的。

For constraint definitions that include no constraint name, the server internally generates a name derived from the associated table name. 对于不包含约束名称的约束定义,服务器会在内部生成从关联表名称派生的名称。For example, internally generated foreign key and CHECK constraint names consist of the table name plus _ibfk_ or _chk_ and a number. 例如,内部生成的外键和CHECK约束名称由表名加上_ibfk__chk_和一个数字组成。If the table name is close to the length limit for constraint names, the additional characters required for the constraint name may cause that name to exceed the limit, resulting in an error.如果表名接近约束名称的长度限制,则约束名称所需的额外字符可能会导致该名称超出限制,从而导致错误。

Identifiers are stored using Unicode (UTF-8). This applies to identifiers in table definitions and to identifiers stored in the grant tables in the mysql database. 标识符使用Unicode(UTF-8)进行存储。这适用于表定义中的标识符和存储在mysql数据库中的grant表中的标识符。The sizes of the identifier string columns in the grant tables are measured in characters. You can use multibyte characters without reducing the number of characters permitted for values stored in these columns.授权表中标识符字符串列的大小以字符为单位。您可以使用多字节字符,而不必减少存储在这些列中的值所允许的字符数。

Prior to NDB 8.0.18, NDB Cluster imposed a maximum length of 63 characters for names of databases and tables. As of NDB 8.0.18, this limitation is removed. See Section 23.1.7.11, “Previous NDB Cluster Issues Resolved in NDB Cluster 8.0”.在NDB 8.0.18之前,NDB Cluster规定数据库和表的名称的最大长度为63个字符。自NDB 8.0.18起,该限制被取消。参见第23.1.7.11节,“NDB集群8.0中解决的先前NDB集群问题”

Values such as user name and host names in MySQL account names are strings rather than identifiers. For information about the maximum length of such values as stored in grant tables, see Grant Table Scope Column Properties.MySQL帐户名中的用户名和主机名等值是字符串,而不是标识符。有关存储在授予表中的此类值的最大长度的信息,请参阅授予表作用域列属性