Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where is my.ini in MacOS Sierra

Tags:

mysql

macos

I installed mysql with homebrew with this guide https://gist.github.com/nrollr/3f57fc15ded7dddddcc4e82fe137b58e

Now I need to delete the server variable NO_ZERO_DATE from the mysql configuration but i don't found mysql conf file. Where is located this file?

like image 626
Evelin Ponce Avatar asked Sep 13 '25 07:09

Evelin Ponce


1 Answers

In MacOS the my.ini file is found as my.cnf, you can look for it in terminal with

> mysql --help

"Default options are read from the following files in the given order: /etc/my.cnf /etc/mysql/my.cnf /usr/local/etc/my.cnf ~/.my.cnf"

But if you hadn't found the cnf in the locations that help show you, try with the next command

> ls $(brew --prefix mysql)/support-files/my-*  

For example, I got this file

/usr/local/opt/mysql/support-files/my-default.cnf

then you need to copy this file to one of your default directories, in my case /etc/my.cnf

> sudo cp /usr/local/opt/mysql/support-files/my-default.cnf /etc/my.cnf

Finally open your cnf file and delete STRICT_TRANS_TABLES from sql_mode

> nano /etc/my.cnf

sql_mode=NO_ENGINE_SUBSTITUTION 

Exit with ctrl+x and press S

Don't forget to restart your mysql server

> sudo mysql.server stop
> sudo mysql.server start
like image 127
Evelin Ponce Avatar answered Sep 14 '25 20:09

Evelin Ponce