If I create a signed MEDIUMINT column without a width specifier, MySQL automatically adds a width of 9. However, the range of a signed MEDIUMINT is -8388608 to 8388607, which only needs 8 display characters max including the sign.

I tested all the other *INT types without a width and the default width MySQL assigned matched the worst case maximum number of characters needed to output the datatype. Why does a signed MEDIUMINT default to +1 character?


  • do you mean that in Mediumint data type , instead of having width 9 , it displays character only upto 7 and one is for signed but in INT data type (which is 11) it display 10 digits and 1 is for signed . so you are asking why mediumint is having one extra character ? Do you mean this ? – simplifiedDB Jul 13 '17 at 6:25
  • Yes. My app is comparing a MySQL-reported schema against a reference schema without length, so I was just wondering why MySQL has an extra length for MEDIUMINT that what appears necessary. – jimp Jul 13 '17 at 18:30

Hmmm... Sounds like a bug. But since that number is not used for anything (assuming you don't have ZEROFILL), then it is no big deal.

You could, if you like, file a bug report at bugs.mysql.com .

  • You are right. And there was already a bug report for it. Thanks. – jimp Jul 13 '17 at 18:50
  • Bug report is 4 years old; obviously no urgency. – Rick James Jul 13 '17 at 19:34
  • True. I left a comment on it anyway as it seems like an easy fix. The last bug I reported for MySQL took almost 4 years to close, but someone eventually took care of it. – jimp Jul 13 '17 at 23:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.