information_schema数据库代表什么?

发布于 2024-09-06 06:55:52 字数 272 浏览 4 评论 0原文

我在mysql中有一个数据库。

但是当我登录 phpMyAdmin 时,它显示另一个名为 information_schema 的数据库。

该数据库是否始终与一个数据库一起存在?

我的意思是说,mysql 中存在的每个数据库是否都有一份 information_schema 的副本,或者每个 mysql 服务器是否有一个名为 information_schema 的数据库?

如果我修改此 information_schema 数据库,这将如何影响我当前的数据库?

I have one database in mysql.

But when i log into phpMyAdmin , it shows another database called information_schema.

Is that database always present with one database?

I mean to say is there a copy of information_schema for every database present in mysql or is there one database called inforemation_schema per mysql server?

If i modify this information_schema database how will that affect my current database?

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

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

发布评论

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

评论(1

涙—继续流 2024-09-13 06:55:52

您可以将 information_schema 视为一个“主数据库”,它保存有关服务器上所有其他数据库的详细信息,例如表、列和用户的名称和类型。

什么是信息架构?

来自参考文档:

INFORMATION_SCHEMA 提供对
数据库元数据。

元数据是关于数据的数据,例如
作为数据库或表的名称,
列的数据类型或访问权限
特权。有时会出现的其他术语
用于此信息的是数据
字典和系统目录。

INFORMATION_SCHEMA 是信息
数据库,存储的地方
关于所有其他人的信息
MySQL 服务器的数据库
维持。 INFORMATION_SCHEMA 内部
有几个只读表。
它们实际上是观点,而不是基础
表,所以没有文件
与他们相关。

information_schema 中存储了什么?

您可以通过查看 this 来查看 information_schema 中存储的内容类型以及它们的组织方式图(适用于 MySQL 5.0)或此图(适用于MySQL 5.1)。

如果我修改 information_schema 会发生什么?

实际上,information_schema 是只读视图的集合。因此,不可能对其进行修改并造成任何损坏。但是,有关此主题的 MySQL 常见问题解答这就是说:

23.7.3:我可以添加或以其他方式修改在
INFORMATION_SCHEMA 数据库?

没有。
由于应用程序可能依赖于
一定的标准结构,这
不应修改。为了这
原因,我们无法支持错误或
导致的其他问题
修改 INFORMATION_SCHEMA 表或
数据。

这意味着,如果您确实发现自己能够修改 information_schema(这应该是不可能的,并且在 MySQL 中,但 SQL 的其他供应商实现可能允许),您至少应该选择不这样做。如果您可能损坏/修改information_schema,那么您就会损坏其他数据库的实际结构(例如表名、列类型)。

每个用户都有自己的 information_schema 副本吗?

每个用户都可以看到与他们有权访问的表和数据库相关的 information_schema。一些权限严重受限的用户仍会看到 information_schema,但对于任何 information_schema 查询只能看到 NULL 值。然而,重要的是要记住,information_schema 不是一个实际的数据库,而只是 SQL 提供的一种方便的方式,以便您可以选择有关数据库和表的信息。

来自参考文档:

每个MySQL用户都有权
访问这些表,但只能看到
表中对应的行
到用户拥有的对象
适当的访问权限。在一些
案例(例如,
ROUTINE_DEFINITION 列中
INFORMATION_SCHEMA.ROUTINES 表),
权限不足的用户
将看到 NULL。

我在哪里可以找到更多信息?

You can think of information_schema as a "master database" that holds details about all the other databases on the server such as the names and types of tables, columns and users.

What is information_schema?

From the reference documentation:

INFORMATION_SCHEMA provides access to
database metadata.

Metadata is data about the data, such
as the name of a database or table,
the data type of a column, or access
privileges. Other terms that sometimes
are used for this information are data
dictionary and system catalog.

INFORMATION_SCHEMA is the information
database, the place that stores
information about all the other
databases that the MySQL server
maintains. Inside INFORMATION_SCHEMA
there are several read-only tables.
They are actually views, not base
tables, so there are no files
associated with them.

What is stored in information_schema?

You can see the kinds of things stored in information_schema, and the way in which they are organised, by viewing this diagram (for MySQL 5.0) or this diagram (for MySQL 5.1).

What happens if I modify information_schema?

In reality, information_schema is a collection of read-only views. As such, it should be impossible to modify it and do any damage. However, the MySQL FAQ on this topic has this to say:

23.7.3: Can I add to or otherwise modify the tables found in the
INFORMATION_SCHEMA database?

No.
Since applications may rely on a
certain standard structure, this
should not be modified. For this
reason, we cannot support bugs or
other issues which result from
modifying INFORMATION_SCHEMA tables or
data.

This implies that if you do find yourself able to modify information_schema (which should be impossible, and is in MySQL, but other vendor implementations of SQL might allow it) you should at the very least choose not to. If you could damage/modify information_schema you'd be damaging the actual structure (e.g. table names, column types) of your other databases.

Does every user have their own copy of information_schema?

Each user can see information_schema that pertains to the tables and databases they have access to. Some users with heavily limited rights will still see information_schema but will see only NULL values for any information_schema queries. However, it is important to remember that information_schema is not an actual database, but simply a convenient way SQL provides so that you can select information about your database(s) and table(s).

From the reference documentation:

Each MySQL user has the right to
access these tables, but can see only
the rows in the tables that correspond
to objects for which the user has the
proper access privileges. In some
cases (for example, the
ROUTINE_DEFINITION column in the
INFORMATION_SCHEMA.ROUTINES table),
users who have insufficient privileges
will see NULL.

Where can I find more information?

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