码迷,mamicode.com
首页 > 数据库 > 详细

mysql8 安装无my.ini配置文件和执行groupBy报错修改sql_mode不生效的解决方案

时间:2020-07-30 18:17:41      阅读:163      评论:0      收藏:0      [点我收藏+]

标签:needed   文件   遇到的问题   global   hang   most   import   imp   结果   

安装很多次mysql,linux,windows版本的都有遇到的问题,总是不总结,结果就是走很多弯路,所以此次记录一下。

1.首先安装完mysql8.0.21 后,发现无my.ini,解决办法

1)默认安装到c盘会自动隐藏,记得打开隐藏文件找到他

2)找不到的情况下,在mysql的安装目录下新建my.ini文件(注意:刚新建完是没有小齿轮的,需要以下配置信息添加进去)

 

# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.6/en/server-configuration-defaults.html
# *** DO NOT EDIT THIS FILE. It‘s a template which will be copied to the
# *** default location during install, and will be replaced if you
# *** upgrade to a newer version of MySQL.
[client]
default-character-set = utf8mb4
[mysql]
default-character-set = utf8mb4
[mysqld]
character-set-client-handshake = FALSE
character-set-server = utf8mb4
collation-server = utf8mb4_bin
init_connect=‘SET NAMES utf8mb4‘
# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
innodb_buffer_pool_size = 128M
# Remove leading # to turn on a very important data integrity option: logging
# changes to the binary log between backups.
# log_bin
# These are commonly set, remove the # and set as required.
basedir = E:\mysql-8.0.21-winx64
datadir = E:\mysql-8.0.21-winx64\data
port = 3306
# server_id = .....
# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
join_buffer_size = 128M
sort_buffer_size = 16M
read_rnd_buffer_size = 16M 
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES

 

 

 

2.报错[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

1网上的解决方案都是修改sql_mode 但是因为我的my.ini没有这个文件,怎么改都不生效,如果您也遇到同样的问题记得先把第一步操作了,重新启动mysq

2)在添加my.ini文件的时候就把sql_mode参数添加进去

3)该方法若mysql重启则失效

mysql中执行 show variables like ‘%sql_mode‘;

set @@GLOBAL.sql_mode=‘STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION‘;

mysql8 安装无my.ini配置文件和执行groupBy报错修改sql_mode不生效的解决方案

标签:needed   文件   遇到的问题   global   hang   most   import   imp   结果   

原文地址:https://www.cnblogs.com/missmeng/p/13404228.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!