Installing MySQL on OS X
This User Tip describes how to download, install, and setup MySQL for use on macOS. Please read through the entire User Tip before starting.
Requirements:
- Basic understanding of Terminal.app and how to run command-line programs.
Download the current version of MySQL from the Community Server. If you have a new Apple Silicon M1 or M2 computer, download the ARM DMG Archive. Otherwise, download the older x86 version. At the time of writing this User Tip, the current version is 8.1.0. By the time you read this, there may be a newer version to use instead. Go to the mysql-8.1.0-macos13-arm64 volumes and double-click the mysql-8.1.0-macos13-arm64.pkg file to install.
MySQL is now up and running. You can control the server from the newly installed Settings pane in System Settings > MySQL.
If you want to run MySQL from the command line, you will need to setup the following aliases:
alias mysql=/usr/local/mysql/bin/mysql
alias mysqladmin=/usr/local/mysql/bin/mysqladmin
You can add these to your .zshrc file or add /usr/local/mysql/bin to your PATH.