DeX Posted May 19, 2016 Share Posted May 19, 2016 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. Quote Link to comment https://forums.phpfreaks.com/topic/301218-mysql-57-now-requires-default-data-settings-for-all-columns/ Share on other sites More sharing options...
Jacques1 Posted May 19, 2016 Share Posted May 19, 2016 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. Quote Link to comment https://forums.phpfreaks.com/topic/301218-mysql-57-now-requires-default-data-settings-for-all-columns/#findComment-1533098 Share on other sites More sharing options...
DeX Posted May 19, 2016 Author Share Posted May 19, 2016 By repairing the schema, do you mean adding default data values to all those columns? Quote Link to comment https://forums.phpfreaks.com/topic/301218-mysql-57-now-requires-default-data-settings-for-all-columns/#findComment-1533099 Share on other sites More sharing options...
Jacques1 Posted May 19, 2016 Share Posted May 19, 2016 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. Quote Link to comment https://forums.phpfreaks.com/topic/301218-mysql-57-now-requires-default-data-settings-for-all-columns/#findComment-1533100 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.