Home > Blockchain >  The column width of integer types is ignored in your MySQL version unless defining a TINYINT(1) colu
The column width of integer types is ignored in your MySQL version unless defining a TINYINT(1) colu

Time:10-04

I'm trying to create an INT with primary key and auto AUTO_INCREMENT column in MYSQL and I'm getting this error The column width of integer types is ignored in your MySQL version unless defining a TINYINT(1) column Documentation What should I do to make it work?

CodePudding user response:

Just remove the "length" part of the integer type. It is deprecated in the current version of MySQL.

WRONG:

CREATE TABLE mytable (
 id INT(11) AUTO_INCREMENT PRIMARY KEY
 ...

RIGHT:

CREATE TABLE mytable (
 id INT AUTO_INCREMENT PRIMARY KEY
 ...

The "length" of an integer always meant almost nothing, even for TINYINT.

See my answer to Types in MySQL: BigInt(20) vs Int(20)

  • Related