对于自制mysql安装,my.cnf在哪里?它安装了吗?
当前回答
服务器版本:8.0.19 Homebrew。macOS Catalina 10.15.5,通过Homebrew安装MySQL在这里找到这个文件:
/usr/local/etc/my.cnf
这个解决方案有帮助:)
其他回答
有一种方法可以知道:
sudo /usr/libexec/locate.updatedb
# wait a few minutes for it to finish
locate my.cnf
在shell上输入my_print_defaults——help
在结果的底部,您应该能够看到服务器从中读取配置的文件。它输出如下内容:
Default options are read from the following files in the given order:
/etc/my.cnf /etc/mysql/my.cnf /usr/local/etc/my.cnf ~/.my.cnf
如果您使用的是mac m1 (Apple silicon), my.cnf位于
/opt/homebrew/etc/my.cnf
也可以通过mysql——help找到
没有什么能真正帮到我——我无法覆盖/etc/my.cnf文件中的设置。 所以我搜索了约翰建议的https://stackoverflow.com/a/7974114/717251
sudo /usr/libexec/locate.updatedb
# wait a few minutes for it to finish
locate my.cnf
它发现另一个my.cnf在
/usr/local/Cellar/mysql/5.6.21/my.cnf
更改这个文件对我有用!别忘了重启启动Agent:
launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
更新:
如果你最近安装了homebrew,你应该使用brew services命令重新启动mysql(使用你安装的homebrew mysql版本,即mysql或mysql@5.7):
brew services stop mysql
brew services start mysql
我已经使用Homebrew安装了MySQL 5.7
My.cnf文件位于“/opt/homebrew/etc/ My.cnf”
推荐文章
- 如何关闭mysql密码验证?
- MySQL区分大小写查询
- MySQL数据库表中的最大记录数
- 原则-如何打印出真正的sql,而不仅仅是准备好的语句?
- PHP/MySQL插入一行然后获取id
- 如何从命令行通过mysql运行一个查询?
- 如何从命令行在windows中找到mysql数据目录
- 如何找到MySQL的根密码
- 如何改变字符集(和排序)在整个数据库?
- mySQL:: insert到表,数据从另一个表?
- 重复键忽略?
- Homebrew:以新的formula@version格式列出可用版本
- 将表从一个数据库复制到另一个数据库的最简单方法?
- 如何通过查询在MySQL中获得数据库结构?
- MySQL删除表中的所有行,并将ID重置为零