在mac 上使用 brew 安装 mysql 后,发现 /etc/my.cnf
并不存在。
于是使用命令查找 MySQL 的配置启动文件列表:
$ mysqld --help --verbose | less
...
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
...
依次查找,发现文件:/usr/local/etc/my.cnf
存在!
即 通过 brew 安装的 MySQL 的配置文件为:/usr/local/etc/my.cnf
网上说的使用 ls $(brew --prefix mysql)/support-files/my-*
作为配置文件的,经查,目前我使用的版本是没有对应的文件的!!!
我的版本为:
$ brew info mysql
mysql: stable 5.7.21 (bottled), devel 8.0.4-rc
Open source relational database management system
https://dev.mysql.com/doc/refman/5.7/en/
Conflicts with:
mariadb (because mysql, mariadb, and percona install the same binaries.)
mariadb-connector-c (because both install plugins)
mysql-cluster (because mysql, mariadb, and percona install the same binaries.)
mysql-connector-c (because both install MySQL client libraries)
percona-server (because mysql, mariadb, and percona install the same binaries.)
/usr/local/Cellar/mysql/5.7.21 (323 files, 235.0MB) *
Poured from bottle on 2018-03-13 at 16:09:50
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/mysql.rb