How to set query_cache_type=2 on mac? I want to enable query_cache_type and change its value to DEMAND.
When I am doing it via terminal its giving this error:


  ERROR 1651 (HY000): Query cache is disabled; restart the server with query_cache_type=1 to enable it


The path for my.cnf is /usr/local/mysql/my.cnf.
Could not find proper my.cnf, so had to find the preferred location where mysql is searching for my.cnf by using the command:

mysql --help | grep cnf


which displays

/etc/my.cnf /etc/mysql/my.cnf /usr/local/mysql/etc/my.cnf ~/.my.cnf


So I created a file  /etc/my.cnf with the required settings, restarted the server, and everything worked like a charm.