TL;DR: MySQL won’t start if it tries to run as root. Fix it by resetting ownership of the data directory to your local user.

If your local MySQL server installed via Homebrew suddenly refuses to start on macOS (like mine did), and your logs show something like this:

[ERROR] [MY-010123] [Server] Fatal error: Please read "Security" section of the manual to find out how to run mysqld as root!

It likely means MySQL is trying to run as root, which is disallowed by default for security reasons.

This usually happens if the MySQL data directory’s ownership was changed to root, causing the server to attempt startup with elevated permissions.

To fix it:

brew services stop mysql
sudo chown -R $(whoami) /opt/homebrew/var/mysql
brew services start mysql
brew services list