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)?
1 Answer
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.
-
1What 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. Oct 10, 2020 at 9:14
TINYINT(1)
which is a synonim for BOOLEAN; 2) While the column is defined with ZEROFILL option (deprecated too).