Installation with Homebrew
brew install mysql installs the server (mysqld) and client (mysql). Start it as a background service with brew services start mysql. The configuration is /opt/homebrew/etc/my.cnf and the data lives under /opt/homebrew/var/mysql (Apple Silicon; /usr/local on Intel).
Securing the installation
Homebrew's MySQL starts without a root password. Run mysql_secure_installation right away to set one, remove anonymous accounts, and drop the test database. Then connect with mysql -u root -p.
Common pitfalls
If port 3306 is already taken, adjust port in my.cnf and restart with brew services restart mysql. Never expose MySQL on a public interface without a strong password and a firewall.