Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

For homebrew mysql installs, where's my.cnf?

Tags:

mysql

homebrew

For homebrew mysql installs, where's my.cnf? Does it install one?

like image 476
chrismealy Avatar asked Nov 01 '11 22:11

chrismealy


People also ask

Where is my MySQL CNF file?

cnf is located in /etc/mysql/my. cnf .

Where is my CNF Windows MySQL?

MySQL looks for it in the following locations (in this order): %PROGRAMDATA%\MySQL\MySQL Server 5.7\my. ini , %PROGRAMDATA%\MySQL\MySQL Server 5.7\my. cnf.

Where is server CNF?

The Server Configuration File. Configuration settings for the Integration Server are stored in the server configuration file (server. cnf). This file resides in the Integration Server_directory \instances\instance_name\config directory and contains parameters that determine how the server operates.


2 Answers

There is no my.cnf by default. As such, MySQL starts with all of the default settings. If you want to create your own my.cnf to override any defaults, place it at /etc/my.cnf.

Also, you can run mysql --help and look through it for the conf locations listed.

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  The following groups are read: mysql client The following options may be given as the first argument: --print-defaults        Print the program argument list and exit. --no-defaults           Don't read default options from any option file. --defaults-file=#       Only read default options from the given file #. --defaults-extra-file=# Read this file after the global files are read. 

As you can see, there are also some options for bypassing the conf files, or specifying other files to read when you invoke mysql on the command line.

like image 166
Jericon Avatar answered Nov 01 '22 15:11

Jericon


The homebrew mysql contains sample configuration files in the installation's support-files folder.

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

If you need to change the default settings you can use one of these as a starting point.

cp $(brew --prefix mysql)/support-files/my-default.cnf /usr/local/etc/my.cnf 

As @rednaw points out, a homebrew install of MySQL will most likely be in /usr/local so the my.cnf file should not be added to the system /etc folder, so I’ve changed the command to copy the file into /usr/local/etc.

If you are using MariaDB rather than MySQL use the following:

cp $(brew --prefix mariadb)/support-files/my-small.cnf /usr/local/etc/my.cnf 
like image 37
ewalshe Avatar answered Nov 01 '22 14:11

ewalshe