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

2019-01-09 21:49发布

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

11条回答
【Aperson】
2楼-- · 2019-01-09 22:19

On your shell type my_print_defaults --help

At the bottom of the result, you should be able to see the file from which the server reads the configurations. It prints something like this:

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
查看更多
成全新的幸福
3楼-- · 2019-01-09 22:24

You can find where the my.cnf file has been provided by the specific package, e.g.

brew list mysql # or: mariadb

In addition to verify if that file is read, you can run:

sudo fs_usage | grep my.cnf

which will show you filesystem activity in real-time related to that file.

查看更多
兄弟一词,经得起流年.
4楼-- · 2019-01-09 22:28

in my system it was

nano /usr/local/etc/my.cnf.default 

as template and

nano /usr/local/etc/my.cnf

as working.

查看更多
看我几分像从前
5楼-- · 2019-01-09 22:32

I believe the answer is no. Installing one in ~/.my.cnf or /usr/local/etc seems to be the preferred solution.

查看更多
Lonely孤独者°
6楼-- · 2019-01-09 22:34

For MacOS (High Sierra), MySQL that has been installed with home brew.

Increasing the global variables from mysql environment was not successful. So in that case creating of ~/.my.cnf is the safest option. Adding variables with [mysqld] will include the changes (Note: if you change with [mysql] , the change might not work).

<~/.my.cnf> [mysqld] connect_timeout = 43200 max_allowed_packet = 2048M net_buffer_length = 512M

Restart the mysql server. and check the variables. y

sql> SELECT @@max_allowed_packet; +----------------------+ | @@max_allowed_packet | +----------------------+ | 1073741824 | +----------------------+

1 row in set (0.00 sec)

查看更多
登录 后发表回答