【Solution】MySQL 5.8 this is incompatible with sql_mode=only_full_group_by
[42000][1055] Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'test.ai.id' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by
solve:
1、首先启动mysql服务
启动MySQL服务
sudo /usr/local/mysql/support-files/mysql.server start
停止MySQL服务
sudo /usr/local/mysql/support-files/mysql.server stop
重启MySQL服务
sudo /usr/local/mysql/support-files/mysql.server restart
2、进入命令行:mysql -u root -p
3、mysql在新版中去掉了默认配置文件my.cnf如果需要可以手动创建
1)在 /etc 新建 my.cnf 文件
sudo vim my.cnf
1
2)将如下配置内容写入到文件中
- # Example MySQL config file for medium systems.
- #
- # This is for a system with little memory (32M - 64M) where MySQL plays
- # an important part, or systems up to 128M where MySQL is used together with
- # other programs (such as a web server)
- #
- # MySQL programs look for option files in a set of
- # locations which depend on the deployment platform.
- # You can copy this option file to one of those
- # locations. For information about these locations, see:
- # http://dev.mysql.com/doc/mysql/en/option-files.html
- #
- # In this file, you can use all long options that a program supports.
- # If you want to know which options a program supports, run the program
- # with the "--help" option.
- # The following options will be passed to all MySQL clients
- [client]
- default-character-set=utf8
- #password = your_password
- port = 3306
- socket = /tmp/mysql.sock
- # Here follows entries for some specific programs
- # The MySQL server
- [mysqld]
- character-set-server=utf8
- port = 3306
- socket = /tmp/mysql.sock
- skip-external-locking
- key_buffer_size = 16M
- max_allowed_packet = 1M
- table_open_cache = 64
- sort_buffer_size = 512K
- net_buffer_length = 8K
- read_buffer_size = 256K
- read_rnd_buffer_size = 512K
- myisam_sort_buffer_size = 8M
- character-set-server=utf8
- init_connect='SET NAMES utf8'
- # Don't listen on a TCP/IP port at all. This can be a security enhancement,
- # if all processes that need to connect to mysqld run on the same host.
- # All interaction with mysqld must be made via Unix sockets or named pipes.
- # Note that using this option without enabling named pipes on Windows
- # (via the "enable-named-pipe" option) will render mysqld useless!
- #
- #skip-networking
- # Replication Master Server (default)
- # binary logging is required for replication
- log-bin=mysql-bin
- # binary logging format - mixed recommended
- binlog_format=mixed
- # required unique id between 1 and 2^32 - 1
- # defaults to 1 if master-host is not set
- # but will not function as a master if omitted
- server-id = 1
- # Replication Slave (comment out master section to use this)
- #
- # To configure this host as a replication slave, you can choose between
- # two methods :
- #
- # 1) Use the CHANGE MASTER TO command (fully described in our manual) -
- # the syntax is:
- #
- # CHANGE MASTER TO MASTER_HOST=<host>, MASTER_PORT=<port>,
- # MASTER_USER=<user>, MASTER_PASSWORD=<password> ;
- #
- # where you replace <host>, <user>, <password> by quoted strings and
- # <port> by the master's port number (3306 by default).
- #
- # Example:
- #
- # CHANGE MASTER TO MASTER_HOST='125.564.12.1', MASTER_PORT=3306,
- # MASTER_USER='joe', MASTER_PASSWORD='secret';
- #
- # OR
- #
- # 2) Set the variables below. However, in case you choose this method, then
- # start replication for the first time (even unsuccessfully, for example
- # if you mistyped the password in master-password and the slave fails to
- # connect), the slave will create a master.info file, and any later
- # change in this file to the variables' values below will be ignored and
- # overridden by the content of the master.info file, unless you shutdown
- # the slave server, delete master.info and restart the slaver server.
- # For that reason, you may want to leave the lines below untouched
- # (commented) and instead use CHANGE MASTER TO (see above)
- #
- # required unique id between 2 and 2^32 - 1
- # (and different from the master)
- # defaults to 2 if master-host is set
- # but will not function as a slave if omitted
- #server-id = 2
- #
- # The replication master for this slave - required
- #master-host = <hostname>
- #
- # The username the slave will use for authentication when connecting
- # to the master - required
- #master-user = <username>
- #
- # The password the slave will authenticate with when connecting to
- # the master - required
- #master-password = <password>
- #
- # The port the master is listening on.
- # optional - defaults to 3306
- #master-port = <port>
- #
- # binary logging - not required for slaves, but recommended
- #log-bin=mysql-bin
- # Uncomment the following if you are using InnoDB tables
- #innodb_data_home_dir = /usr/local/mysql/data
- #innodb_data_file_path = ibdata1:10M:autoextend
- #innodb_log_group_home_dir = /usr/local/mysql/data
- # You can set .._buffer_pool_size up to 50 - 80 %
- # of RAM but beware of setting memory usage too high
- #innodb_buffer_pool_size = 16M
- #innodb_additional_mem_pool_size = 2M
- # Set .._log_file_size to 25 % of buffer pool size
- #innodb_log_file_size = 5M
- #innodb_log_buffer_size = 8M
- #innodb_flush_log_at_trx_commit = 1
- #innodb_lock_wait_timeout = 50
- [mysqldump]
- quick
- max_allowed_packet = 16M
- [mysql]
- no-auto-rehash
- # Remove the next comment character if you are not familiar with SQL
- #safe-updates
- default-character-set=utf8
- [myisamchk]
- key_buffer_size = 20M
- sort_buffer_size = 20M
- read_buffer = 2M
- write_buffer = 2M
- [mysqlhotcopy]
- interactive-timeout
特别注意,可以加入:
sql_mode='NO_AUTO_VALUE_ON_ZERO,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION,PIPES_AS_CONCAT,ANSI_QUOTES'
修改权限 chmod 664 my.cnf 以及用户权限
修改设置
select @@sql_mode
SET sql_mode=(SELECT REPLACE(@@sql_mode,'ONLY_FULL_GROUP_BY',''));
【Solution】MySQL 5.8 this is incompatible with sql_mode=only_full_group_by的更多相关文章
- mysql报错this is incompatible with sql_mode=only_full_group_by
1.报错信息 com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: In aggregated query without GROUP ...
- mysql报错处理:incompatible with sql_mode=only_full_group_by
问题: 服务报错:incompatible with sql_mode=only_full_group_by,如下图所示: 分析: NLY_FULL_GROUP_BY是MySQL提供的一个sql_mo ...
- mysql 查询出现 "this is incompatible with sql_mode=only_full_group_by"错误解决方案,以及个人rpm方式重装所遇到的问题备份
一.错误说明 这个错误发生在mysql 5.7 版本及以上版本会出现的问题: mysql .7版本默认的sql配置是:sql_mode="ONLY_FULL_GR ...
- 【推荐】MySQL Cluster报错及解决方法(不断更新中)
排查问题技巧: MySQL Cluster 自带了一个错误代码的查看的小程序.通过这个小东西我们可以方便的定位问题的原因. 这个程序就是 perror 在MYSQL安装目录的bin下面. 如报错:ER ...
- 【转】mysql数据库中实现内连接、左连接、右连接
[转]mysql数据库中实现内连接.左连接.右连接 内连接:把两个表中数据对应的数据查出来 外连接:以某个表为基础把对应数据查出来 首先创建数据库中的表,数据库代码如下: /* Navicat MyS ...
- 【Conclusion】MySQL使用
MySQL使用 因为数据库实验用到了MySQL,这里对现在已经涉及到的MySQL部分操作做一个简单的小结. 1.安装MySQL 上MySQL的官网下载对应自己OS平台的MySQL安装文件,有在线安装和 ...
- 【转】mysql索引使用技巧及注意事项
一.索引的作用 一般的应用系统,读写比例在10:1左右,而且插入操作和一般的更新操作很少出现性能问题,遇到最多的,也是最容易出问题的,还是一些复杂的查询操作,所以查询语句的优化显然是重中之重. 在数据 ...
- 【转】MySQL— pymysql and SQLAlchemy
[转]MySQL— pymysql and SQLAlchemy 目录 一.pymysql 二.SQLAlchemy 一.pymysql pymsql是Python中操作MySQL的模块,其使用方法和 ...
- 【转】MySQL— 索引
[转]MySQL— 索引 目录 一.索引 二.索引类型 三.索引种类 四.操作索引 五.创建索引的时机 六.命中索引 七.其它注意事项 八.LIMIT分页 九.执行计划 十.慢查询日志 一.索引 My ...
随机推荐
- selenium+python-unittest多线程生成报告
前言 selenium多线程跑用例,这个前面一篇已经解决了,如何生成一个测试报告这个是难点,刚好在github上有个大神分享了BeautifulReport,完美的结合起来,就能生成报告了. 环境必备 ...
- mysql查看每个数据库所占磁盘大小
#查看每个数据库所占磁盘大小 SELECT TABLE_SCHEMA AS "库名", , ) AS "表所占空间(MB)", , ) AS "索引所 ...
- Servlet(四):request和response对象
Request对象:问题: 浏览器发起请求到服务器,会遵循HTTP协议将请求数据发送给服务器. 那么服务器接受到请求的数据改怎么存储呢?不但要存,而且要保证完成性. 解决: 使用对象进行存储,服务器每 ...
- 2018山东省赛sequence
2018山东省赛sequence因为必须要删除一个数,所以可以计算每个数删除的代价,从而选取代价最小的进行删除如果一个数大于它前面的所有数的最小值而小于次小值,删除最小值的代价就要+1:如果一个数本身 ...
- leetcode刷题第二天<两数相加>
题目描述 给出两个 非空 的链表用来表示两个非负的整数.其中,它们各自的位数是按照 逆序 的方式存储的,并且它们的每个节点只能存储 一位 数字. 如果,我们将这两个数相加起来,则会返回一个新的链表来表 ...
- Ubuntu14.04和16.04官方默认更新源sources.list和第三方源推荐(干货!)
不多说,直接上干货! 写在前面:笔者由于还在学校学习,学校没有开发给Linux用的上网客户端,所以只能用在windows系统中通过安装虚拟机运行linux比较方便,但没有外网,只有学校的教育网,所以我 ...
- JavaScript异步加载的三种方式——async和defer、动态创建script
一.script标签的位置 传统的做法是:所有script元素都放在head元素中,必须等到全部js代码都被下载.解析.执行完毕后,才能开始呈现网页的内容(浏览器在遇到<body>标签时才 ...
- 在VS2010上安装MVC4(webApi)
我们安装的VS2010上是没有MVC4或者WebApi的,要想加入这些功能只能自己在网上下载安装. 要安装MVC4,首先得安装VS10sp(Service Package)1,然后再安装MVC4.安装 ...
- Python-Django学习
1,安装Django与python版本的对应1.8 2.7,3.2--3.51.9,1.10 2.7,3.4,3.51.11 2.7,3.4,3.5,3.62.0 2.1 第一种安装:pip inst ...
- 潭州课堂25班:Ph201805201 tornado 项目 第九课 深入应用 WebSockets(课堂笔记)
tornado 相关说明 在 handler 中创建一个 chat.py 文件,用来处理聊天室 在 templates 模板文件夹下创建 room.html 文件,是个聊天室 做好服务器的准备