内置数据库“information_schema"未在用户创建的数据库中记录表的最后更新时间

内置数据库 information_schematables 表不会将用户创建的数据库中的表的活动记录为字段 table_schematable_name 分别缺少用户创建的数据库和表名的值,不允许我运行 SQL 查询

The tables table of the in-built database information_schema does not log the activities of the tables in user created databases as the fields table_schema and table_name lacks the values of the user created databases and table names respectively, disallowing me to run the SQL query

SELECT update_time 
FROM information_schema.tables 
WHERE table_schema='my_db' and table_name='my_table';
-- For table named 'my_table' in database 'my_db'

用于检索数据库中表的最后更新时间(或更改时间)(即特定表中数据的最后一次更新、删除或插入的时间),以决定是否需要备份.

for retrieving last update time (or changed time) of a table in database (i.e. the last time when data in a specific table is updated, deleted or inserted) for deciding whether a backup is needed or not.

谁能帮我解决这个在数据库中记录活动的问题并解释一下背后的原因?

Can anyone please help me solve this problem of logging activities in database and explain me the reason behind it?

提前致谢.

推荐答案

显然您的表是 InnoDB,并且您使用的 MariaDB 版本低于 10.2.

Apparently your tables are InnoDB, and you are using MariaDB version below 10.2.

您遇到的是一个旧的 MySQL 错误(或者更确切地说是一个没有功能,正如 InnoDB 团队所设想的那样).它已在最新的稳定 InnoDB 中得到修复,该 InnoDB 包含在 MariaDB 10.2.

What you have encountered is an old MySQL bug (or rather an absence of feature, as it was envisioned by the InnoDB team). It has been fixed in the latest stable InnoDB, which is included into MariaDB 10.2.

对于 MyISAM 表,它也应该在以前的版本中工作.

For MyISAM tables it should work in previous versions too.

相关文章