模式就是数据库,因此 SCHEMATA 表提供关于数据库的信息。A schema is a database, so the
SCHEMATA table provides information
about databases.
SCHEMATA 表有这些列:The SCHEMATA table has these columns:
CATALOG_NAMECATALOG_NAME模式所属目录的名称。此值始终为
def。The name of the catalog to which the schema belongs. This value is alwaysdef.SCHEMA_NAMESCHEMA_NAME模式的名称。The name of the schema.
DEFAULT_CHARACTER_SET_NAME模式默认字符集。The schema default character set.
DEFAULT_COLLATION_NAME模式默认排序规则。The schema default collation.
SQL_PATH该值始终为
NULL。This value is alwaysNULL.DEFAULT_ENCRYPTION模式默认加密方式。The schema default encryption.
模式名称也可以通过 SHOW
DATABASES 语句获取。参见 第 15.7.7.15 节,“SHOW DATABASES 语句”。以下语句是等效的:Schema names are also available from the SHOW
DATABASES statement. See
Section 15.7.7.15, “SHOW DATABASES Statement”. The following statements are
equivalent:
SELECT SCHEMA_NAME AS `Database` FROM INFORMATION_SCHEMA.SCHEMATA [WHERE SCHEMA_NAME LIKE 'wild'] SHOW DATABASES [LIKE 'wild']
除非您拥有全局SHOW
DATABASES权限,否则您只能看到那些您拥有某种权限的数据库。You see only those databases for which you have some kind of
privilege, unless you have the global SHOW
DATABASES privilege.
因为任何静态全局权限都被视为对所有数据库的权限,所以任何静态全局权限都可以使用户通过 SHOW
DATABASES 查看所有数据库名称,或通过检查 SCHEMATA 表(位于 INFORMATION_SCHEMA 中)来查看所有数据库名称,但被数据库级别的部分撤销限制的数据库除外。Because any static global privilege is considered a privilege
for all databases, any static global privilege enables a user to
see all database names with SHOW
DATABASES or by examining the
SCHEMATA table of
INFORMATION_SCHEMA, except databases that
have been restricted at the database level by partial revokes.
注意事项Notes
SCHEMATA_EXTENSIONS表通过提供关于模式选项的信息来扩展SCHEMATA表。TheSCHEMATA_EXTENSIONStable augments theSCHEMATAtable with information about schema options.