mysql searches for your local my.cnf in a number of default places, so finding which is actually in use can be an issue.
To find which search paths are currently being used by your current mysql install (from here), use:
mysql --help | grep my.cnf
And it will show a list of paths like this:
> mysql --help | grep my.cnf
order of preference, my.cnf, $MYSQL_TCP_PORT,
/etc/my.cnf /etc/mysql/my.cnf /opt/homebrew/etc/my.cnf ~/.my.cnf
Note that if you installed mysql via homebrew (on MacOS), this will also show the homebrew path where my.cnf is located.