Fix MySQL error(sql_mode=only_full_group_by)

Problem: [Err] 1055 - Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated column ‘informat

1. Description

Environment: MAMP

MySQL version: 5.7.21

2. Solution

By default, the OS X installation does not use a my.cnf, and MySQL just uses the default values. To set up your own my.cnf, you could just create this file. Thus, do as followed:

a. Create my.cnf under /Application/MAMP/conf

b. Add configuration in my.cnf:

1
2
3
[mysqld]

sql_mode='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION'

3. Reference

(1) Mac 的mysql5.7没有配置文件,如何解决only_full_group_by 问题

(2) does-mysql-included-with-mamp-not-include-a-config-file

(3) how-can-set-sql-mode-permanently-on-my-mac

0%