[SOLVED] Field 'referer_url' doesn't have a default value In query: INSERT INTO piwik_log_visit


A few weeks ago, I updated Piwik (I think it was from 2.5.0 to 2.6.0 or 2.6.1). Everything seemed to be working again. But after a week or so, i saw there were no visits logged. At the time I could debug stuff, there was a new update 2.7.0. So I first installed that one. But this didn’t fix the issue.

No new visits are logged in the piwik_log_visit table. But when I look into the php error loggings, I see next line now and then. (I think this is the time, a new visit is tried to being logged):
Error in Piwik (tracker): Error query: SQLSTATE[HY000]: General error: 1364 Field ‘referer_url’ doesn’t have a default value In query: INSERT INTO piwik_log_visit (idvisitor, config_id, location_ip, location_country, config_resolution, config_windowsmedia, config_pdf, config_quicktime…

Running Piwik 2.7.0 on IIS 7 with php 5.5.

I tried to change the default value in the table, but got error like:
#1101 - BLOB/TEXT column ‘referer_url’ can’t have a default value

any ideas?


I’ve fixed this issue by reinstalling Piwik. So I think, the previous update was done wrong somehow.
But now it works again.

Just removed the config/config.ini.php file, went to the Piwik pages and did the install again (with the same settings as the previous install). So I’ve got all my data back (except the unregistered visits).

(Marcos Yoshihiro Nakamine) #3

works for me to


(Amine) #4

I will add the solution I found since I didn’t want to reinstall Matomo, I activated plugin Referrers, which did nothing, then activated Goals plugin, which required a database updates, one of them was: ALTER TABLE piwik_log_visit MODIFY COLUMN referer_url TEXT NULL;

That solved it for me.