Last active
December 16, 2021 02:19
-
-
Save hissy/8ef404aa7292f5ef95eb814a8d500111 to your computer and use it in GitHub Desktop.
#concrete5 set sql_mode from database.php config file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* How to set sql_mode from database.php | |
* It will help to solve the error like "SQLSTATE[42000]: Syntax error or access violation: | |
* 1055 Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated column | |
* 'concrete5.cv.cvPublishDate' which is not functionally dependent on columns in GROUP BY clause; | |
* this is incompatible with sql_mode=only_full_group_by" | |
*/ | |
return [ | |
'default-connection' => 'concrete', | |
'connections' => [ | |
'concrete' => [ | |
'driver' => 'c5_pdo_mysql', | |
'server' => '127.0.0.1', | |
'database' => 'concrete5', | |
'username' => 'username', | |
'password' => 'password', | |
'character_set' => 'utf8mb4', | |
'collation' => 'utf8mb4_unicode_ci', | |
'driverOptions' => [ | |
PDO::MYSQL_ATTR_INIT_COMMAND => "SET sql_mode=(SELECT REPLACE(@@sql_mode,'ONLY_FULL_GROUP_BY',''))", | |
], | |
], | |
], | |
]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment