MarcDieters Posted November 5, 2015 Share Posted November 5, 2015 (edited) Hi, I'm new to prestashop. I want to setup Presta on a Server 2012 R2 box. Here are the steps I took: - Installed IIS, PHP (used the Web Platform downloader) and MySQL. - Created a schema, a user and provided the user full permissions on the schema. - Created a website and copied the downloaded Presta files to the correct location. - Browsed to the website and followed the steps. At 12%, when the database is created the attached error occurs. SQL error on query All parts of a PRIMARY KEY must be NOT NULL; if you need NULL in a key, use UNIQUE instead The database is filled with tables though, so it's not a permissions issue I think. The versions I use (all the latest that can be found). - MySQL: 5.7 - PHP 5.6.0 (5.3.28 is also installed). - Presta: 1.6.12. I don't have any experience with PHP / MySQL so I'm really stuck. Can anyone provide some guidance how I can get the site setup ? Thanks. Edited November 5, 2015 by MarcDieters (see edit history) Link to comment Share on other sites More sharing options...
MarcDieters Posted November 5, 2015 Author Share Posted November 5, 2015 I have found the issue. To fix it, replace the following text in the db_structure.sql in \install\data CREATE TABLE `PREFIX_cart_product` ( `id_cart` int(10) unsigned NOT NULL, `id_product` int(10) unsigned NOT NULL, `id_address_delivery` int(10) UNSIGNED DEFAULT '0', `id_shop` int(10) unsigned NOT NULL DEFAULT '1', `id_product_attribute` int(10) unsigned DEFAULT NULL, `quantity` int(10) unsigned NOT NULL DEFAULT '0', `date_add` datetime NOT NULL, UNIQUE(`id_cart`,`id_product`,`id_product_attribute`,`id_address_delivery`), KEY `id_product_attribute` (`id_product_attribute`), KEY `id_cart_order` (`id_cart`, `date_add`, `id_product`, `id_product_attribute`)); After this change, I was able to complete the store creation. 5 Link to comment Share on other sites More sharing options...
Swissity Posted November 26, 2015 Share Posted November 26, 2015 (edited) I ran into the exact same issue.... What is the best way to open and edit the db_structure.sql file? Nevermind.... used Wordpad. Edited November 26, 2015 by Swissity (see edit history) Link to comment Share on other sites More sharing options...
joseantgv Posted January 5, 2016 Share Posted January 5, 2016 I ran into the exact same issue.... What is the best way to open and edit the db_structure.sql file? Nevermind.... used Wordpad. It would be better to use another editor as Sublime, Atom or even notepad. Link to comment Share on other sites More sharing options...
NielsRudbeck Posted February 29, 2016 Share Posted February 29, 2016 I have found the issue. To fix it, replace the following text in the db_structure.sql in \install\data CREATE TABLE `PREFIX_cart_product` ( `id_cart` int(10) unsigned NOT NULL, `id_product` int(10) unsigned NOT NULL, `id_address_delivery` int(10) UNSIGNED DEFAULT '0', `id_shop` int(10) unsigned NOT NULL DEFAULT '1', `id_product_attribute` int(10) unsigned DEFAULT NULL, `quantity` int(10) unsigned NOT NULL DEFAULT '0', `date_add` datetime NOT NULL, UNIQUE(`id_cart`,`id_product`,`id_product_attribute`,`id_address_delivery`), KEY `id_product_attribute` (`id_product_attribute`), KEY `id_cart_order` (`id_cart`, `date_add`, `id_product`, `id_product_attribute`) ); After this change, I was able to complete the store creation. Awesome! Thanks for the help! Link to comment Share on other sites More sharing options...
CharlieA Posted March 27, 2016 Share Posted March 27, 2016 Same here - Great suggestion. Still installing but got past DB creation... BTW - Notepad ++ is a great text editor. Link to comment Share on other sites More sharing options...
daniboy1969 Posted September 26, 2016 Share Posted September 26, 2016 Hello, I am still having issues installing this.... First I was getting the primary key issue, then I got an invalid date issue, now am getting an SQL error on query Invalid default value for 'available_date'... I dont know what else to do.... Link to comment Share on other sites More sharing options...
daniboy1969 Posted September 26, 2016 Share Posted September 26, 2016 here is my db_structure file, I am still getting the SQL error on query Invalid default value for 'available_date' can you take a look at this please, thank you db_structure.zip Link to comment Share on other sites More sharing options...
daniboy1969 Posted September 26, 2016 Share Posted September 26, 2016 Hello, I was able to get to this point by changing the dates, now what?!!! Link to comment Share on other sites More sharing options...
bnadauld Posted August 25, 2023 Share Posted August 25, 2023 wo this is old but im updaing an old shop. The error can be caused by having a new version of mysql i downgraded to Server version: 5.6.51 - MySQL Community Server (GPL) can got round the problem Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now