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


当前回答

Mac OS X Mavericks的当前MySQL包(在撰写本文时为MySQL -5.6.17-osx10.7-x86_64)在安装期间自动创建my.cnf。

它位于/usr/local/mysql-5.6.17-osx10.7-x86_64/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 M1和MacOS Monterey 12.0.1中使用Homebrew安装MySQL,则位置为/opt/ Homebrew /etc/my.cnf

我在macOS High Sierra 10.13.3版本中使用mysql 5.7.17版本,我在这里找到了mysql配置文件。

cd /usr/local/mysql/support-files/my-default.cnf

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

/ usr / local / etc / my . cnf

Mac OS X Mavericks的当前MySQL包(在撰写本文时为MySQL -5.6.17-osx10.7-x86_64)在安装期间自动创建my.cnf。

它位于/usr/local/mysql-5.6.17-osx10.7-x86_64/my.cnf 根据您的版本调整路径。