mysql获取数据库表最后更新时间,update_time 为null (update_time innodb)
2014-11-14 17:34
525 查看
http://www.busfly.net/csdn/post/mysql-show-get-database-info.html
http://www.dbforums.com/mysql/1657703-update_time-innodb.html
查询语句的话是 SELECT '表名',UPDATE_TIME FROM information_schema.tables where TABLE_SCHEMA='数据库';"
或者用变量 show table status.
但是我查到的 update_time 和check_time 总是null 。information_schema的tables表也无法修改。百度,google几乎都是在自己的表中的update_time相关的。
费劲力气终于在老外网站上(第二个链接)找到了:In the MySQL "information_schema" database is a table called "TABLES" and it has a "UPDATE_TIME"
column for each table in all databases on the given s MySQL server.
For MyISAM tables the "UPDATE_TIME" field is updated every time a change to the given table is made, for InnoDB tables
the value for "UPDATE_TIME" is always NULL.
Maybe someone knows if there is a patch, so InnoDB tables get their "UPDATE_TIME" value updated as well.
Thanks,
David
原因在于innodb存储引擎不支持(?)update_time,所以,只要把表改成 myisam存储引擎的就 ok了。
http://www.dbforums.com/mysql/1657703-update_time-innodb.html
查询语句的话是 SELECT '表名',UPDATE_TIME FROM information_schema.tables where TABLE_SCHEMA='数据库';"
或者用变量 show table status.
但是我查到的 update_time 和check_time 总是null 。information_schema的tables表也无法修改。百度,google几乎都是在自己的表中的update_time相关的。
费劲力气终于在老外网站上(第二个链接)找到了:In the MySQL "information_schema" database is a table called "TABLES" and it has a "UPDATE_TIME"
column for each table in all databases on the given s MySQL server.
For MyISAM tables the "UPDATE_TIME" field is updated every time a change to the given table is made, for InnoDB tables
the value for "UPDATE_TIME" is always NULL.
Maybe someone knows if there is a patch, so InnoDB tables get their "UPDATE_TIME" value updated as well.
Thanks,
David
原因在于innodb存储引擎不支持(?)update_time,所以,只要把表改成 myisam存储引擎的就 ok了。
相关文章推荐
- mysql获取数据库表最后更新时间,update_time 为null
- Mysql update语句赋值嵌套select,更新和查询同一张表,必须取别名;用例:更新指定游戏服务器最后启动记录的结束时间
- Mysql获取表更新时间update_time注意事项
- LAST_DAY(date) 获取一个日期或日期时间值,返回该月最后一天对应的值。若参数无效,则返回NULL。
- java 把string数据转换成date数据存入mysql的问题,如何获取当前时间date存入数据库
- Mysql根据数据库的时间字段到点更新另外的状态。
- 一天一点MySQL复习——获取数据库系统时间、变量赋值、变量比较
- mysql设置数据库字段类型,保存时自动获取数据库服务器时间
- time(NULL)与GetLocalTime获取当前时间
- MySQL,查看数据库的信息,大小,最后修改时间等
- mysql 表设计时的update_time自动更新
- mysql 如何获取数据库当前时间
- 数据库——mysql如何获取当前时间
- C# 数据库sql中用参数的方法来执行UPDATE命令,实现更新dataTime类型
- PHP获取远程文件最后更新时间
- sharepoint 2007 获取启用特定数量历史版本文件的信息(站点/最后更新时间/author/修改者/版本数/大小)
- Update语句更新多表时在SQL Server,Oracle,MySQL三种数据库中的用法
- mysql 数据库获取当前时间
- 数据库_基础知识_MySQL_UpdateSelect(根据查询出来的结果批量更新)
- Hibernate MySQL的中文乱码问题--中文关键字查询数据库获取为null