I'm install MySql on my OsX 10.11 El Capitan. If I try to start my query I have a strange error if my query have Group By.
So if I try to execute this query from Terminal:
SET GLOBAL sql_mode=(SELECT REPLACE(@@sql_mode,'ONLY_FULL_GROUP_BY',''));
I can execute my query never problem. Now if I try to re-start my macbook, I have the some problem and I can re-execute the query.
There is any way to fix this sql_mode permanently ?
I have tro to open "etc/mysql/my.cnf" file but there isn't this file on my mac. How can I apply this change ?
You could set my.cnf and add your sql_mode config
[mysqld]
sql_mode=ONLY_FULL_GROUP_BY
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 a file straight in /etc.
If you're using MAMP PRO it's worth noting this from the guide:
You cannot edit your my.cnf file directly. You must use the MAMP PRO interface to edit your my.cnf file. In the menu go to File > Edit Template > MySQL > my.cnf.
Then you can add the sql_mode you want under the [mysqld] heading. e.g:
[mysqld]
sql_mode=ONLY_FULL_GROUP_BY
This is what worked for me.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With