我试图按照本教程来启用远程访问MySQL。问题是,my.cnf文件应该放在哪里?我使用的是Mac OS X Lion。


当前回答

/private/etc/my.cnf for Catalina

其他回答

它通常应该在MAC上的/usr/local/etc下,如果你找不到它,你可以创建一个

macOS sierra 10.12.6 MySQL版本:5.7.18_1 我运行locate my。cnf,路径是

/ usr / local / etc / my . cnf

对于MAMP 3.5 Mac El Capitan,创建一个单独的空配置文件,并为mysql编写额外的设置

sudo vim /Applications/MAMP/Library/my.cnf

像这样相加

[mysqld]
max_allowed_packet = 256M

你可以在任何你想要的目录下创建你的文件。创建完成后,你可以“告诉”mysql配置的路径:

In my case, the file did not exist. In MySQL Workbench I went to OPTIONS FILE and found some default values. I clicked apply. It asked for permission. It then created the my.cnf file under /etc. However, it is very important to keep in mind that the first time you click "apply", you do not make any changes to the default configuration. Once the file has been created, you can make changes which will be applied when you click "apply". Otherwise you will not be shown the apply button when you make changes.