MySQL can’t insert without default val on auto-increment

So, I had a weird error with MySQL 5.6 Win 64 server.  Every time I tried to insert a record, I got an error that a field didn’t have a default value.  I was using Apache OpenOffice, with an ODBC driver, but the same underlying problem occurred with MySQL WorkBench, so it was a MySQL server issue, not a client or driver issue.  The funny thing was that the field in question was the primary key, and was an “auto-increment” field.  Hence, no default value can be provided.  I couldn’t fix it, until I removed the auto-increment attribute for the field in the table.  Saved.  Then, added it back.  Magically, it worked.

Leave a Reply

Your email address will not be published. Required fields are marked *