mysql8.0 在macos环境下 彻底解决 sql_mode 问题
mysql新版本 group by 1055问题,真的很讨厌........终于忍不住了,临时方法缺点是每次启动都要重新设置,于是找方法,但是网上说的都会做了但是启动不了,不生效,亲自看了下mysql.server 配置文件,启动时会读取 /etc/my.cnf 或者安装目录下的my.cnf
1、临时解决方案
SELECT @@sql_mode 查询看到 有这么个讨厌的东西 ONLY_FULL_GROUP_BY , 于是去掉这个值, set sql_mode = 修改后的值
2、彻底解决
在mysql 的安装目录下 添加 my.cnf
/usr/local/mysql-8.0.23-macos10.15-x86_64
配置文件
#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. [mysqld] # 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 = ..... # datadir = ..... # port = ..... # server_id = ..... # socket = ..... # 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 = 2M # read_rnd_buffer_size = 2M #配置不包含ONLY_FULL_GROUP_BY sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
重启mysql ok 彻底解决 (必须是命令行启动,我也搞不懂,在mac的系统便好设置的左下角点mysql启动为什么不生效,命令行配置可以网上搜搜)