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


当前回答

rDefault选项按照给定的顺序从以下文件中读取: /etc/my.cnf /etc/mysql/my.cnf /usr/local/mysql/etc/my.cnf ~/.my.cnf

其他回答

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.

您可以打开一个终端并键入locate my.cnf

在MAC OS上,一个快速的方法是:

sudo find /usr/ -type f -iname "*my.cnf*"

or

brew list mysql@5.7 |grep -i my.cnf

问候

mysql 8.0.19,我终于找到my.cnf在这里: /usr/local/opt/mysql/.bottle/etc 我把它复制到 /usr/local/opt/mysql/ 并进行了修改。然后我重新启动mysql服务,它工作。

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