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

前端 未结 13 1294
夕颜
夕颜 2020-12-02 03:16

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

相关标签:
13条回答
  • 2020-12-02 04:06
    1. $ps aux | grep mysqld /usr/local/opt/mysql/bin/mysqld --basedir=/usr/local/opt/mysql --datadir=/usr/local/var/mysql --plugin-dir=/usr/local/opt/mysql/lib/plugin

    2. Drop your my.cf file to /usr/local/opt/mysql

    3. brew services restart mysql

    0 讨论(0)
  • 2020-12-02 04:07

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

    0 讨论(0)
  • 2020-12-02 04:10

    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
    
    0 讨论(0)
  • 2020-12-02 04:11

    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.

    0 讨论(0)
  • 2020-12-02 04:14

    In case of Homebrew, mysql would also look for my.cnf in it's Cellar directory, for example:

    /usr/local/Cellar/mysql/5.7.21/my.cnf
    

    For the case one prefers to keep the config close to the binaries - create my.cnf here if it's missing.

    Restart mysql after change:

    brew services restart mysql
    
    0 讨论(0)
  • 2020-12-02 04:16

    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)

    0 讨论(0)
提交回复
热议问题