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


当前回答

MySQL论坛上的这个帖子说:

默认情况下,OS X安装不使用my.cnf, MySQL只使用默认值。要设置你自己的my.cnf,你可以直接在/etc中创建一个文件。

OS X在/usr/local/mysql/support-files/目录下提供了配置文件示例。

如果你在那里找不到它们,MySQLWorkbench可以为你创建它们:

打开连接 在菜单中选择“实例”下的“选项文件”。 MySQLWorkbench将搜索my.cnf,如果找不到它,它将为您创建它

其他回答

MySQL 5.7 on Mac OS X El Capitan: /usr/local/mysql/etc/my.cnf

从/usr/local/mysql/support-files/my-default.cnf拷贝default conf文件

与所有这些伟大的答案相反。如果你在一个没有sudo权限的环境中工作。你的Homebrew可以安装在你的主目录下~如果是这种情况,你的mysql已经通过brew安装,安装mysql你的my.cnf可以位于~/ Homebrew /etc/my.cnf或者你也可以在你的home目录中查找。/ name '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.

在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服务,它工作。