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

本文记录了在安装MySQL8.0.21后遇到的两个问题及其解决方案:一是找不到my.ini配置文件,二是执行groupBy语句时遇到sql_mode不生效的错误。解决方案包括在正确位置创建my.ini文件并设置必要的配置项,以及通过修改sql_mode变量来解决GROUP BY错误。
摘要由CSDN通过智能技术生成

安装很多次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 ifyou

#***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 RAMforthe most important data

# cache in MySQL. Start at70% 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 usefulforreporting servers.

# The server defaults are fasterfortransactions 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';

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值