veda-consulting-company / uk.co.vedaconsulting.mailchimp

Other
22 stars 43 forks source link

DB error when installing #269

Closed caliginous closed 7 years ago

caliginous commented 7 years ago

Hello

Am using 2.0 and latest civicrm on wordpress. When I hit install I get this error:

"DB Error: unknown error"

Any ideas?

Dan

mjvanhaastert commented 7 years ago

Get the same error when using it on drupal

"DB Error: unknown error"

Part of the debug log:

0 /var/www/civicrm.nl/sites/all/modules/civicrm/CRM/Core/Error.php(187): CRM_Core_Error::backtrace()

1 /var/www/civicrm.nl/sites/all/modules/civicrm/packages/PEAR.php(921): CRM_Core_Error::handle(Object(DB_Error))

2 /var/www/civicrm.nl/sites/all/modules/civicrm/packages/DB.php(984): PEAR_Error->__construct("DB Error: unknown error", -1, 16, (Array:2), "INSERT INTO civicrm_custom_group (name , title , extends , style , collapse_d...")

3 /var/www/civicrm.nl/sites/all/modules/civicrm/packages/PEAR.php(575): DB_Error->__construct(-1, 16, (Array:2), "INSERT INTO civicrm_custom_group (name , title , extends , style , collapse_d...")

4 /var/www/civicrm.nl/sites/all/modules/civicrm/packages/PEAR.php(223): PEAR->_raiseError(Object(DB_mysqli), NULL, -1, 16, (Array:2), "INSERT INTO civicrm_custom_group (name , title , extends , style , collapse_d...", "DB_Error", TRUE)

5 /var/www/civicrm.nl/sites/all/modules/civicrm/packages/DB/common.php(1905): PEAR->__call("raiseError", (Array:7))

6 /var/www/civicrm.nl/sites/all/modules/civicrm/packages/DB/mysqli.php(933): DB_common->raiseError(-1, NULL, NULL, "INSERT INTO civicrm_custom_group (name , title , extends , style , collapse_d...", "1292 ** Incorrect datetime value: '0' for column 'created_date' at row 1")

7 /var/www/civicrm.nl/sites/all/modules/civicrm/packages/DB/mysqli.php(403): DB_mysqli->mysqliRaiseError()

8 /var/www/civicrm.nl/sites/all/modules/civicrm/packages/DB/common.php(1216): DB_mysqli->simpleQuery("INSERT INTO civicrm_custom_group (name , title , extends , style , collapse_d...")

9 /var/www/civicrm.nl/sites/all/modules/civicrm/packages/DB/DataObject.php(2438): DB_common->query("INSERT INTO civicrm_custom_group (name , title , extends , style , collapse_d...")

10 /var/www/civicrm.nl/sites/all/modules/civicrm/packages/DB/DataObject.php(1060): DB_DataObject->_query("INSERT INTO civicrm_custom_group (name , title , extends , style , collapse_d...")

11 /var/www/civicrm.nl/sites/all/modules/civicrm/CRM/Core/DAO.php(487): DB_DataObject->insert()

12 /var/www/civicrm.nl/sites/all/modules/civicrm/CRM/Utils/Migrate/Import.php(130): CRM_Core_DAO->save()

13 /var/www/civicrm.nl/sites/all/modules/civicrm/CRM/Utils/Migrate/Import.php(211): CRM_Utils_Migrate_Import->copyData(Object(CRM_Core_DAO_CustomGroup), Object(SimpleXMLElement), TRUE, "name")

14 /var/www/civicrm.nl/sites/all/modules/civicrm/CRM/Utils/Migrate/Import.php(78): CRM_Utils_Migrate_Import->customGroups(Object(SimpleXMLElement), (Array:2))

15 /var/www/civicrm.nl/sites/all/modules/civicrm/CRM/Utils/Migrate/Import.php(56): CRM_Utils_Migrate_Import->runXmlElement(Object(SimpleXMLElement))

MegaphoneJon commented 7 years ago

Hi @caliginous and @mjvanhaastert - I ran into this problem too. I'm guessing you're running MySQL 5.7, which has stricter controls on "sql_mode". For instance, if you run this in MySQL:

show variables LIKE 'sql_mode';

You'll probably see something like:

+---------------+----------------------------------------------------------------------------------------------------------------
| Variable_name | Value                                                                                                                                     |
+---------------+-------------------------------------------------------------------------------------------------------------------------------------------+
| sql_mode      | ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION |
+---------------+-------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.01 sec)

"NO_ZERO_DATE" is just what it sounds like - in newer versions of MySQL, the default is to disallow putting in zeroes for a date, which this extension does.

I just submitted a patch - but if you don't know how to merge it, it just involves removing the "created date" line from xml/auto_install.xml.

caliginous commented 7 years ago

That's awesome, it worked. Thank you so much for replying!

On 7 April 2017 at 23:21, Jon notifications@github.com wrote:

Hi @caliginous https://github.com/caliginous and @mjvanhaastert https://github.com/mjvanhaastert - I ran into this problem too. I'm guessing you're running MySQL 5.7, which has stricter controls on "sql_mode". For instance, if you run this in MySQL:

show variables LIKE 'sql_mode';

You'll probably see something like:

+---------------+---------------------------------------------------------------------------------------------------------------- | Variable_name | Value | +---------------+-------------------------------------------------------------------------------------------------------------------------------------------+ | sql_mode | ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION | +---------------+-------------------------------------------------------------------------------------------------------------------------------------------+ 1 row in set (0.01 sec)

"NO_ZERO_DATE" is just what it sounds like - in newer versions of MySQL, the default is to disallow putting in zeroes for a date, which this extension does.

I just submitted a patch - but if you don't know how to merge it, it just involves removing the "created date" line from xml/auto_install.xml.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/veda-consulting/uk.co.vedaconsulting.mailchimp/issues/269#issuecomment-292665798, or mute the thread https://github.com/notifications/unsubscribe-auth/ABKMiDIF4Fw4fmZCRREXfJek5afCdil7ks5rtrbrgaJpZM4MzYt- .

mjvanhaastert commented 7 years ago

Thanks that did solve the problem for me to

michaelmcandrew commented 7 years ago

Hey there, this is a workaround which I think will stop working at some point as MySQL has decided 00000 dates are bad (see https://stackoverflow.com/questions/22806870/incorrect-datetime-value-database-error-number-1292)

The above PR fixes the issue