You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Mac OS Catalina下my.cnf/mysql.conf配置文件位置查询

Finding MySQL Config File for Official .pkg Install on macOS

Hey there! I’ve dealt with this exact scenario before when using MySQL’s official .pkg installer instead of Homebrew—let’s break down where to locate (or create) your my.cnf file:

1. First, check where MySQL actually looks for config files

The easiest way to see all the paths MySQL will search by default is to run this terminal command:

mysqld --help --verbose | grep -A 1 "Default options"

You’ll get output that looks something like this (paths vary slightly by MySQL version):

Default options are read from the following files in the given order:
/etc/my.cnf /etc/mysql/my.cnf /usr/local/mysql/etc/my.cnf ~/.my.cnf

For .pkg installs, /etc/my.cnf is the standard go-to location, but often the installer doesn’t create this file automatically—so that’s why you didn’t find it at first!

2. Create the config file if it doesn’t exist

If none of the listed paths have a my.cnf file, you can create one manually at /etc/my.cnf using a terminal text editor like nano:

sudo nano /etc/my.cnf

Add your desired configuration settings (wrap them in the appropriate sections, like [mysqld] for server settings). For example:

[mysqld]
innodb_buffer_pool_size = 512M
max_connections = 200

Save and exit nano by pressing Ctrl+O, hitting Enter, then Ctrl+X.

3. Restart MySQL to apply changes

After editing or creating the file, you’ll need to restart the MySQL service for changes to take effect. Use these commands:

sudo launchctl stop com.oracle.oss.mysql.mysqld
sudo launchctl start com.oracle.oss.mysql.mysqld

Quick note on plist files

You might notice a plist file at /Library/LaunchDaemons/com.oracle.oss.mysql.mysqld.plist—this is just for managing how MySQL starts up on your Mac, not for database configuration settings. All your actual MySQL tweaks go in my.cnf.

内容的提问来源于stack exchange,提问作者Mathe Eliel

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.07 19:57:31