我试图按照本教程来启用远程访问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
其他回答
如果在Mac M1和MacOS Monterey 12.0.1中使用Homebrew安装MySQL,则位置为/opt/ Homebrew /etc/my.cnf
您可以检查文件
/usr/local/bin/mysql.服务器,看看my.conf是从哪里读取的。
通常是从/etc/my.cnf或~/my.cnf或~/.my.cnf
/private/etc/my.cnf for Catalina
我在macOS Sierra上安装了MySql 5.7.12
支持文件位于
/usr/local/opt/mysql/support-files
只要将my-default.cnf复制到/etc/my.cnf或/etc/mysql/my.cnf,重新启动时配置就会被拾取。
通常,在Unix和类Unix系统上,MySQL/MariaDB程序在以下位置读取配置/启动文件(按指定顺序):
/etc/my.cnf - Global /etc/mysql/my.cnf - Global SYSCONFDIR/my.cnf - Global SYSCONFDIR represents the directory specified with the SYSCONFDIR option to CMake when MySQL was built. By default, this is the etc directory located under the compiled-in installation directory. $MYSQL_HOME/my.cnf - Server-specific (server only) MYSQL_HOME is an environment variable containing the path to the directory in which the server-specific my.cnf file resides. If MYSQL_HOME is not set and you start the server using the mysqld_safe program, mysqld_safe sets it to BASEDIR, the MySQL base installation directory. file specified with --defaults-extra-file=path if any ~/.my.cnf - User-specific ~/.mylogin.cnf - User-specific (clients only)
来源:使用选项文件。
注意:在Unix平台上,MySQL忽略全局可写的配置文件。这是有意为之的安全措施。
此外,在Mac上有一个简单的方法来检查它。
执行命令sudo fs_usage | grep my.cnf 这将实时报告与该文件相关的任何文件系统活动。 在另一个终端,重新启动MySQL/MariaDB,例如: 重启mysql 或者: Brew服务重新启动mariadb 在终端上使用fs_usage,应该显示正确的位置,例如。 15:52:22 access /usr/local/Cellar/mariadb/10.1.14/my.cnf 0.000002 sh 因此,如果该文件不存在,就创建一个。
推荐文章
- NSRange从Swift Range?
- 在MongoDB中查找重复的记录
- 如何在交互式Python中查看整个命令历史?
- 在MySQL中检测值是否为number
- MySQL中两个日期之间的差异
- 为什么在MySQL中文本列不能有一个默认值?
- 使用SQL查询查找最近的纬度/经度
- 模式、表和数据库之间的区别是什么?
- 在OSX中永久设置PATH环境变量
- 如何停止mysqld
- 检查MySQL表是否存在而不使用“select from”语法?
- 从NOW() -1天选择记录
- 我看到VARCHAR(255)如此频繁地使用(而不是其他长度),有什么好的原因吗?
- 使用pgadmin连接到heroku数据库
- 从表中选择1是什么意思?