The following error came up on a project built on Django and MySQL:
“Warning: Field ‘id’ doesn’t have a default value”
At first, it seemed as though Django was responsible. However, a quick Google search proved this was an issue with MySQL.
Some solutions returned by the search required the programmer/administrator to export and recreate the database, but the solution proved a lot more simple. For a table named auth_user, the following MySQL command fixes the above error message:
ALTER TABLE auth_user MODIFY `id` INT(11) NOT NULL AUTO_INCREMENT; |
The above command resets the ID field of the auth_user
table to an auto-incremented integer of length 11, fixing the error message for good.
I am working through some Ruby on Rails tutorials, and this saved me some time. Thanks!