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


当前回答

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

/ usr / local / etc / my . cnf

其他回答

将/usr/local/opt/mysql/support-files/my-default.cnf复制为/etc/my.cnf或/etc/mysql/my.cnf,然后重启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.

您可以检查文件

/usr/local/bin/mysql.服务器,看看my.conf是从哪里读取的。

通常是从/etc/my.cnf或~/my.cnf或~/.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文件

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