2

When I try to create a table with a column of type INT, it automatically gets allocated as INT(11) and this Int length will get depreciated in the latest version of MySQL. How can I declare the column as INT except of INT(11)?

  • 2
    The 11 is not a "length restriction" - it's a hint for applications on the preferred display width for values in that columns – a_horse_with_no_name Oct 9 at 20:40
  • 1
    The length makes sense in two situations only. 1) TINYINT(1) which is a synonim for BOOLEAN; 2) While the column is defined with ZEROFILL option (deprecated too). – Akina Oct 10 at 15:11
3

Just because it is deprecated does not mean it won't work.

Just don't explicitly specify length anymore when creating new tables.

Let MySQL figure out how the length will be handled.

Personally, I never used the length operator in my years as a DBA. Besides, the length operator (11) simply stands for the display on a signed INT.

What is the range of a signed INT ??? -2147483648 to 2147483647. Please note that -2147483648 is 11 characters. That's why 11 will appear in SHOW CREATE TABLE if you created the table without a length operator.

If you are concerned with how MySQL Workbench handled it, you may need to consider:

  • Upgrading to the latest version of MySQL Workbench
  • Switching to another up-to-date MySQL GUI

For now, the best thing is to run SHOW CREATE TABLE and ALTER TABLE commands without length operators. Let MySQL deprecation happen and don't look back.

| improve this answer | |
  • 1
    What needs to be mentioned here is that the value 11 is a display value and does not determine how much storage space is used to store this number. It describes how to represent the number if converted to a string. As such it's wrong to mix presentation and storage, which is the main reason why all the display widths (not only for INT) are deprecated and will be removed. – Mike Lischke Oct 10 at 9:14

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.