Jump to content

MySQL 5.7 Now Requires Default Data Settings For All Columns


Recommended Posts

I upgraded my server to Ubuntu 16.04 which also installed MySQL 5.7 with it and now every time I run an insert statement, it errors and tells me there is no default data specified for that column. If I go into PHPMyAdmin and specify default data for all columns, the insert will run without error.

 

How do I turn this off? It's affecting my production sites, I just want it to go back the way it was of inserting empty strings or zeroes (or null) for any column I don't specify.

You need to repair your database schema, not try to bring back MySQL misfeatures.

 

A quick hack to get the old (wrong) behavior is to disable strict mode. However, this also disables important validity checks and doesn't solve anything.

Yes. If you want to omit the data for a column that is declared as NOT NULL, you need a default value.

 

The implicit default values you talked about earlier (0, 0.0, the empty string etc.) are a MySQL quirk which I'd only use as a workaround for completely broken legacy systems. If you can fix the problem, fix it.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.