phpMyAdmin will not allow me to add a new field to my database — the new field is:
Field: itemCount
Type: INT
Length: 5
Default: 'As Defined:' 1
AUTO_INCREMENT: yes
The error I get from phpMyAdmin is:
Error
SQL query:
ALTER TABLE `useritems` CHANGE `itemCount` `itemCount` INT( 5 ) NOT NULL DEFAULT '1' AUTO_INCREMENT
MySQL said: #1067 - Invalid default value for 'itemCount'
(note: the single quotes around the ‘1’ in the error message are not mine — I simply type 1
into phpMyAdmin for the new field.)
I don’t get why I can create an INT, ‘auto-increment’ field but phpMyAdmin says “you can’t set an INT to a default value of 1”
I tried setting it to zero, same error.
I tried making this the primary key field; and I tried it without making the field the primary key. Same error.
How do I get phpMyAdmin to allow me to create an INT field that is auto-increment with a default value of 1 or zero?
By default, for any auto-increment column, the counting starts from 1. If you want to set it to anything higher than that, you may use following Alter query: