I have a system that runs on hundreds of websites and I am getting an error for the first time. I was hoping that someone could tell me what may cause this error so I can try to remove it.
The issue comes when trying to add a page.
INSERT INTO pages (parent, name, type, sort) VALUES ('0', 'test', 'text', '37.5');
This spits out the following error.
[nativecode=1364 ** Field 'text' doesn't have a default value]
I thought this may be code based so I uploaded phpMyAdmin and the error still persisted.
There is a TEXT field called text
. This doesn't have a default value, however it has never needed one. It has worked fine without one up to now.
When I try to set the default field on this server I get the following error.
#1101 - BLOB/TEXT column 'text' can't have a default value
Basically, the question is - what is going on?
Is MySQLi different from MySQL? Could this be the cause.
My server runs mysql 5.0.5, this server runs mysql 5.0.51a. Can I safely assume this isn't the cause?
Does anyone have any ideas or even guesses as to where the cause of this may lie?
I realise this is an old question, but I had a similar problem and found this question via Google without an answer, so in case anyone else does too, here was my solution:
In my case, I was trying to run a shopping cart on my local machine, and I kept getting database errors like the one mentioned in the question. I was using MySQL 5.5.12 and it turns out that the php in my chosen shopping cart was written for an older MySQL version, and this kept flagging up errors and incompatabilities. I'm not going to suggest if you have a similar problem to downgrade, luckily it's not necessary!
What is needed here is for you to disable MySQL strict mode which is causing the compatability issues. To do so all you have to do is run the following query via phpMyAdmin/SQLyog (or chosen interface):
Just to clarify that is two single quotes (').
Refer to this site for more info or other ways to disable MySQL strict mode: http://nickbartlett.com/wordpress/how-to-turn-off-mysql-strict-mode/