Install Mysql
brew install mysql@5.7
I only needed Mysql5.7 at here.
Enable MySQL security mechanism
mysql_secure_installation
can run:
/opt/homebrew/opt/mysql@5.7/bin/mysql_secure_installation
If you need to have mysql@5.7 first in your PATH, run:
echo 'export PATH="/opt/homebrew/opt/mysql@5.7/bin:$PATH"' >> ~/.zshrc
For compilers to find mysql@5.7 you may need to set:
export LDFLAGS="-L/opt/homebrew/opt/mysql@5.7/lib"
export CPPFLAGS="-I/opt/homebrew/opt/mysql@5.7/include"
If you don't want/need a background service you can just run:
/opt/homebrew/opt/mysql@5.7/bin/mysqld_safe --datadir=/opt/homebrew/var/mysql
To connect run:
mysql -u root -p