TL;DR version: here’s how you can solve the Prestashop installation error “SQL error on query Invalid default value for ‘last_connection_date'”.
If you are installing a Prestashop CMS for your e-commerce needs on a server that is configured with a mysql backend with version numbers 5.7, or any of its newer versions, you might get stuck at 12% of the installation screen, and get an error message that says something like “SQL error on query Invalid default value for ‘last_connection_date'” . This error simply means that the version of Prestashop that you are trying to install, used to handle some database management tasks differently, then the current mysql server expects it.
Most importantly, in the newer versions of the mysql server, beginning with version 5.6, some stricter data validation and field validation defaults have been implemented. And because of those “new rules”, some older php/mysql based software, and some CMS-es like Prestashop, will fail to install.
To circumvent these defaults, you can either temporarily, or permanently modify the way the mysql server loads on your system (if you have access to the “my.cnf” on Linux, usually located at /etc/mysql/my.cnf, or “my.ini” on Windows systems).
Open a simple text-editor in terminal (on Linux) or notepad if you are on Windows, and open your “my.cnf” or “my.ini” file. Add the configuration directive that will REMOVE the strict defaults enforcement.
If you already have blocks/sections in your config file, sections like [mysql] or [mysqld], add it to [mysqld].
If your file is the default one, it will probably be almost empty, and end with 2 lines beginning with
Add these two lines then, before the !includedir directives:
Save the file. Restart your mysql server. (service mysql restart from a terminal, if you are on a Linux box, and the Restart Mysql button if you are on a Wamp server on Windows).
Retry the installation by clicking on the “click here to restart” link in the Prestashop installation screen.
Has this how-to helped you ? Please share the blog with your friends on your preferred social media. Still can’t install it ? Leave a comment in the commentbox, with the error message you’ve received, and I’ll do my best to help you.
AlexJanuary 10, 2018 at 14:35
Big thx for your work!
Wookie ChewbaccaJanuary 12, 2018 at 10:52
Hey @Alex, Good to know someone other then bots are still reading the posts 🙂