在mac中修改mysql的sql_mode

在mac环境中遇到MySQL5.7报错'Expression #11 of SELECT list is not in GROUP BY clause...',原因是系统缺少my-default.cnf配置文件。解决方法是创建新的my.cnf文件,在/etc目录下使用sudo vim编辑,设置sql_mode,保存并退出,然后重启MySQL服务。
摘要由CSDN通过智能技术生成

项目中报错“Expression #11 of SELECT list is not in GROUP BY clause and。。。  ”

后查出是mac的问题,MySQL5.7之后针对mac端,并且没有my-default.cnf的用户,需要调整配置信息 。

 

修改期间必须关闭mysql

我们要在/etc下新建my.cnf
$ cd /etc
$ sudo vim my.cnf

my.cnf文件如下

 

# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.7/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=utf8

[mysqld]
log-error=/usr/local/mysql/data/mysqld.log
# skip-grant-tables
# 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: lo
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值