简体   繁体   English

MySQL INFORMATION_SCHEMA 漏洞

[英]MySQL INFORMATION_SCHEMA Bugged

based on this post in phpmyadmin (that i am the owner)基于 phpmyadmin 中的这篇文章(我是所有者)

i dont know what happen with INFORMATION_SCHEMA Table.我不知道 INFORMATION_SCHEMA 表会发生什么。

https://github.com/phpmyadmin/phpmyadmin/issues/16378#issuecomment-703820551 https://github.com/phpmyadmin/phpmyadmin/issues/16378#issuecomment-703820551

I've been digging a bit deeper on the subject and it seems that everything points to a mysql server problem and the "INFORMATION_SCHEMA".我一直在深入研究这个主题,似乎一切都指向 mysql 服务器问题和“INFORMATION_SCHEMA”。

DROP TABLE IF EXISTS `Tbl_Lis_Agencias`;
CREATE TABLE IF NOT EXISTS `Tbl_Lis_Agencias` (
  `IdAgency` int(3) UNSIGNED ZEROFILL NOT NULL AUTO_INCREMENT,
  `AgencyCodU` int(3) UNSIGNED ZEROFILL NOT NULL DEFAULT '000',
  `AgencyName` varchar(40) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `Agency_Order` int UNSIGNED DEFAULT NULL,
  `AgencyStatus` int UNSIGNED NOT NULL DEFAULT '1',
  PRIMARY KEY (`IdAgency`),
  UNIQUE KEY `IdAgency` (`IdAgency`),
  UNIQUE KEY `Agency_Order` (`Agency_Order`),
  UNIQUE KEY `AgencyName` (`AgencyName`),
  KEY `xAgencyStatus` (`AgencyStatus`)
) ENGINE=InnoDB AUTO_INCREMENT=12345 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

INSERT INTO `Tbl_Lis_Agencias` VALUES
(001, 001, 'Panama', 1, 1),
(002, 020, 'Aguadulce', 2, 1),
(003, 080, 'David', 3, 1),
(004, 010, 'Vacamonte', 4, 1);

I have used the Mysql WorkBench, to execute the following query:我使用了 Mysql WorkBench 来执行以下查询:

SELECT `AUTO_INCREMENT`
FROM  INFORMATION_SCHEMA.TABLES
WHERE TABLE_SCHEMA = 'DB_LIS'
AND   TABLE_NAME   = 'Tbl_Lis_Agencias';

**and output: no matter how many times you run the update of auto_increment to the value: 5 ** ** 和输出:无论你运行多少次 auto_increment 更新到值:5 **

ALTER TABLE Tbl_Lis_Agencias AUTO_INCREMENT =5;

图片

but when i go to table option in tab option in software;但是当我进入软件选项卡选项中的表格选项时; not code:不是代码:

图片

图片

### this must be a joke ... what's going on here ??? ### 这一定是个玩笑……这是怎么回事???

MySQL 8.0 tries to cache the statistics about tables, but there seem to be some bugs in the implementation. MySQL 8.0 尝试缓存有关表的统计信息,但在实现中似乎存在一些错误。 Sometimes it shows table statistics as NULL, and sometimes it shows values, but fails to update them as you modify table data.有时它会将表统计信息显示为 NULL,有时它会显示值,但在您修改表数据时无法更新它们。

See https://bugs.mysql.com/bug.php?id=83957 for example, a bug that discusses the problems with this caching behavior.例如,参见https://bugs.mysql.com/bug.php?id=83957 ,一个讨论这种缓存行为问题的错误。

You can disable the caching.您可以禁用缓存。 It may cause queries against the INFORMATION_SCHEMA or SHOW TABLE STATUS to be a little bit slower, but I would guess it's no worse than in versions of MySQL before 8.0.它可能会导致对 INFORMATION_SCHEMA 或 SHOW TABLE STATUS 的查询慢一点,但我想它不会比 8.0 之前的 MySQL 版本差。

SET GLOBAL information_schema_stats_expiry = 0;

The integer value is the number of seconds MySQL keeps statistics cached.整数值是 MySQL 缓存统计信息的秒数。 If you query the table stats, you may see old values from the cache, until they expire and MySQL refreshes them by reading from the storage engine.如果您查询表统计信息,您可能会看到缓存中的旧值,直到它们过期并且 MySQL 通过从存储引擎读取来刷新它们。

The default value for the cache expiration is 86400, or 24 hours.缓存过期的默认值为 86400,即 24 小时。 That seems excessive.这似乎太过分了。

See https://dev.mysql.com/doc/refman/8.0/en/server-system-variables.html#sysvar_information_schema_stats_expiryhttps://dev.mysql.com/doc/refman/8.0/en/server-system-variables.html#sysvar_information_schema_stats_expiry

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM