MAC OS 下怎样找到 MySQL 的配置文件

Run: sudo fs_usage | grep my.cnf

This will report any filesystem activity in real-time related to that file.In another Terminal, restart your MySQL, e.g.

brew services restart mysql

On terminal with fs_usage, the proper location should be shown, e.g.

20:26:32  stat64            /usr/local/Cellar/mysql/5.7.10/my.cnf      0.000002   my_print_def

20:26:32  stat64            /Users/asthman/.my.cnf                     0.000003   my_print_def

20:26:32  stat64            private/etc/my.cnf                         0.000006   my_print_def

20:26:32  stat64            /usr/local/etc/my.cnf                      0.000002   my_print_def

So if the file doesn't exist, create one.

上面的配置文件都没有,所以我就创建了一个 /usr/local/etc/my.cnf,然后写上自己的配置就好了

这篇文章: 有用 无用