I wanted to disable some options in the MySql server strict mode, but for some reason I'm not even able to find its configuration file (my.cnf)
Currently installed MySql: Ver 14.14 Distrib 5.7.20, for macos10.12 (x86_64)
Output generated by
mysql --help
Default options are read from the following files in the given order:
But there is no such file as my.conf
I had done some research work on SO but none of the advises has worked for me.
What I'm supposed to do?
There are defaults built into MySQL. The configuration file(s), if any, override the defaults.
Note that the config files are not looked at except during startup. So, editing or creating such a file has no effect until you restart mysqld
.
If you mess up the syntax, mysqld
will not start. Then you need to find the error, either during startup, or in a log file. (Or you could ask here "what is my syntax error".)
As for the location, and name, of the config files that will be used:
$ mysql --help
gives you the list for mysql
, but perhaps you need it for the server, so try
$ mysqld --help --verbose
gives you long output; maybe 50 lines from the top, you should see something like:
Usage: mysqld [OPTIONS]
Default options are read from the following files in the given order:
/etc/my.cnf /etc/mysql/my.cnf /usr/etc/my.cnf ~/.my.cnf
You asked about my.conf
; was that a typo?
Regardless, If those files are missing, you can create them, make them readable by mysql, and put things into it preceded by [mysqld]
so that the server will see them.
Personal override
Regardless of what is in the defaults and/or config files, you can add to the last file given. In the examples above that is 'hidden' .my.cnf
in your home directory. All you need to do is create a few lines:
[mysql]
some_setting = somevalue
[client]
some_setting = somevalue
That helps for the "mysql" commandline tool and/or other clients (maybe).
But if you need to make changes to the server mysqld
, it needs to be in one of the other files. Again, the minimum is something like
[mysqld]
some_setting = somevalue
Note the mysqld
to refer to the server. And remember to restart the service.
Another note: If you see (in an existing config file), !includedir ...
, then go to that directory to find any number of further files. You could add your own file, say z.cnf
(so it would be picked last) with the two (or more) lines as indicated above.
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