I am getting this error when i run mysql -uroot after installing mysql through brew install mysql
mysql: [ERROR] Found option without preceding group in config file /etc/my.cnf at line 1. mysql: [ERROR] Fatal error in defaults handling. Program aborted!
My "my.cnf" looks like this:
# Default Homebrew MySQL server config
[mysqld]
# Only allow connections from localhost
bind-address = 127.0.0.1
mysqlx-bind-address = 127.0.0.1
I tried every solution online and nothing worked.
- I've added [mysqld] in front of the file.
- I've moved the commented lines.
- I've completely uninstalled mysql using the steps here: https://gist.github.com/vitorbritto/0555879fe4414d18569d and reinstalled it.
I also tried changing the encoding of my my.cnf file from binary to ASCII but it did not change after i run this:
file -I /etc/my.cnf
/etc/my.cnf: application/x-mach-binary; charset=binary
Maybe that's the issue i'm not sure.
Any modification I try, I keep getting the same error mentioned above.
I'm running on a macOS, Big Sur, version 11.6
Please do help.