首页 > 解决方案 > MYSQL - 警告:不推荐使用整数显示宽度

问题描述

我看到这个警告:MYSQL - 警告:#1681 不推荐使用整数显示宽度。MySQL版本:8.0.21

过去,我有显示宽度 (INT(20)) 的列,但我删除了所有列。如您所见,没有显示宽度的列:

询问:

select count(*), COLUMN_TYPE from information_schema.`COLUMNS`
WHERE COLUMN_TYPE LIKE "%int%"
GROUP by COLUMN_TYPE;

结果:

count(*) column_type
    2068 bigint
      96 tinyint(1)
    2285 int
    1267 bigint unsigned
      32 tinyint
      74 int unsigned
       6 smallint unsigned
       1 tinyint unsigned
       1 smallint

正如我所读,tinyint(1) 被忽略: https ://dev.mysql.com/doc/relnotes/mysql/8.0/en/news-8-0-19.html

问题是,我怎样才能让这个警告消失:)

提前致谢!

标签: mysql

解决方案


推荐阅读