mysql 5.7 [Err] 1055 - Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonag
2016-12-14 00:00
489 查看
摘要: [Err] 1055 - Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated column 'information_schema.PROFILING.SEQ' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by
mysql 5.7 [Err] 1055 - Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonag
up vote 111 down vote favorite 32 | I accidentally enabled ONLY_FULL_GROUP_BY mode like this:SET sql_mode = 'ONLY_FULL_GROUP_BY';How do I disable it? mysql mysql-workbench
| ||||||||||||||||||||
|
11 Answers
active oldest votesup vote 16 down vote accepted | Give this a try:SET sql_mode = ''As per @xQbert in the comments above, check http://www.mysqlfaqs.net/mysql-faqs/Client-Server-Commands/What-is-sql-mode-in-MySQL-and-how-can-we-set-it Community Note: As pointed out in the answers below, this actually clears all the SQL modes currently enabled. That may not necessarily be what you want.
| ||||||||||||||||||||
|
up vote 3 down vote | Thanks to @cwhisperer. I had the same issue with Doctrine in a Symfony app. I just added the option to my config.yml:doctrine: dbal: driver: pdo_mysql options: # PDO::MYSQL_ATTR_INIT_COMMAND 1002: "SET sql_mode=(SELECT REPLACE(@@sql_mode,'ONLY_FULL_GROUP_BY',''))"This worked fine for me.
| ||
add a comment |
up vote 2 down vote | On: Ubuntu 14.04 mysql Ver 14.14 Distrib 5.7.16, for Linux (x86_64) using EditLine wrapper Do: $ sudo nano /etc/mysql/conf.d/mysql.cnfCopy and paste: [mysqld] sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTIONTo the bottom of the file $ sudo service mysql restart
| ||||||||
|
up vote 154 down vote | The best way to go about it without emptying sql_mode outmysql > SET GLOBAL sql_mode=(SELECT REPLACE(@@sql_mode,'ONLY_FULL_GROUP_BY',''));it worked for me and you can read more at http://johnemb.blogspot.com.ng/2014/09/adding-or-removing-individual-sql-modes.html
| ||||||||||||||||||||
|
up vote 1 down vote | I'm using doctrine and I have added the driverOptions in my doctrine.local.php :return array( 'doctrine' => array( 'connection' => array( 'orm_default' => array( 'driverClass' => 'Doctrine\DBAL\Driver\PDOMySql\Driver', 'params' => array( 'host' => 'localhost', 'port' => '3306', 'user' => 'myusr', 'password' => 'mypwd', 'dbname' => 'mydb', 'driverOptions' => array( PDO::MYSQL_ATTR_INIT_COMMAND => "SET sql_mode=(SELECT REPLACE(@@sql_mode,'ONLY_FULL_GROUP_BY',''))" ), ), ), ), ));In phpmyadmin the user needs SUPER activated in the privileges.
| ||||
|
up vote 85 down vote | If you want to disable permanently error sql_mode=only_full_group_bydo those steps: sudo nano /etc/mysql/my.cnf Add this to the end of the file [mysqld] sql_mode = "STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION" sudo service mysql restartto restart MySQL This will disable ONLY_FULL_GROUP_BYfor ALL users
| ||||||||||||||||
|
相关文章推荐
- MySQL异常:[Err] 1055 - Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggr
- [Err] 1055 - Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated..
- [Err] 1055 - Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated..
- [Err] 1055 - Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated c
- [Err] 1055 - Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated c
- [Err] 1055 - Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated c
- [Err] 1055 - Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated.
- [Err] 1055 - Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated c
- [Err] 1055 - Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated c
- [Err] 1055 - Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated c
- [Err] 1055 - Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated c
- mysql遇见Expression #1 of SELECT list is not in GROUP BY clause and contains nonag
- mysql 5.7会遇到 [Err] 1055 - Expression #1 of ORDER BY clause is not in GROUP BY clause ...的问题
- [Err] 1055 - Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated colum
- [Err] 1055 - Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated colum
- mysql遇见Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggre的问题
- Docker安装MySQL遇见Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggre的问题
- MySQL报错“Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggre”
- ERROR 1055 (42000): Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregate
- mysql遇见Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggre的问题