Below are the steps that I used to install MySQL on my M1 Mac via the Homebrew package manager. As mentioned, this is an M1 Mac [which uses the ARM64 architecture] but that didn’t cause any issues. The current version [MySQL 8.0.26] supports the ARM architechure. Seeing as I’m installing MySQL via
Homebrew, it requires that Homebrew is installed. You can skip this step if you’ve already got Homebrew installed. To install these prerequisites, open a Terminal window and run the following commands. Install Xcode: Install Homebrew: That’s it. Xcode and Homebrew should be installed once those commands have been run. But before we move on, here’s how to check Homebrew: Follow any prompts to fix any problems that may have been
encountered. While we’re at it, here’s how to update Homebrew: If you’re already up to date, you’ll get a message to that effect.Install Homebrew
xcode-select --install
/bin/bash -c "$[curl -fsSL //raw.githubusercontent.com/Homebrew/install/HEAD/install.sh]"
brew doctor
brew update
Now that Homebrew is installed, let’s go ahead and install MySQL:
brew install mysql
Wait patiently while it downloads and installs everything.
Once installed, the following message appears:
We've installed your MySQL database without a root password. To secure it run: mysql_secure_installation MySQL is configured to only allow connections from localhost by default To connect run: mysql -uroot To start mysql: brew services start mysql Or, if you don't want/need a background service you can just run: /opt/homebrew/opt/mysql/bin/mysqld_safe --datadir=/opt/homebrew/var/mysql
That message provides useful information for getting started.
Start MySQL
Now that we’ve installed MySQL, let’s start it using the first method listed above:
brew services start mysql
That should eventuate in a message like this:
Successfully started `mysql` [label: homebrew.mxcl.mysql]
Connect to MySQL
Once MySQL has started, we can go ahead and connect to it:
mysql -uroot
Once connected, you should see something like this:
MySQL [[none]]>
You can now go ahead and start using MySQL.
Here’s an example of a quick command you can use to see a list of databases:
show databases;
Result:
+--------------------+ | Database | +--------------------+ | information_schema | | mysql | | performance_schema | | sys | +--------------------+ 4 rows in set [0.007 sec]
Alternatives to Homebrew
If you don’t want to use Homebrew, you can install it via the Native Package Installer, which uses the native macOS installer [DMG] to walk you through the installation of MySQL.
Or, you could use the compressed TAR archive, which uses a file packaged using the Unix tar
and gzip
commands.
See the MySQL Installation Guide on the MySQL website for more information.
2.5.1 Installing
MySQL Workbench for macOS is distributed as a DMG file. The file is named mysql-workbench-community-
, where version
-osx.dmgversion
is the MySQL Workbench version. MySQL Workbench provides platform support for the latest version of macOS only [see supported platforms]. The previous version
continues to be supported for a transition period of six months after each new version of macOS is released.
Downloads are available at //dev.mysql.com/downloads/workbench/.
To install MySQL Workbench on macOS, download the file. Double-click the downloaded file to open the installation window shown in the figure that follows.
Figure 2.1 MySQL Workbench macOS Installation Window
Drag the MySQL Workbench icon onto the Applications icon as instructed. MySQL Workbench is now installed. You can now launch MySQL Workbench from the Applications folder or from the command line.
For a list of macOS versions that the MySQL server supports, see //www.mysql.com/support/supportedplatforms/database.html.
MySQL for macOS is available in a number of different forms:
Native Package Installer, which uses the native macOS installer [DMG] to walk you through the installation of MySQL. For more information, see Section 2.4.2, “Installing MySQL on macOS Using Native Packages”. You can use the package installer with macOS. The user you use to perform the installation must have administrator privileges.
Compressed TAR archive, which uses a file packaged using the Unix tar and gzip commands. To use this method, you need to open a Terminal window. You do not need administrator privileges using this method; you can install the MySQL server anywhere using this method. For more information on using this method, you can use the generic instructions for using a tarball, Section 2.2, “Installing MySQL on Unix/Linux Using Generic Binaries”.
In addition to the core installation, the Package Installer also includes Section 2.4.3, “Installing and Using the MySQL Launch Daemon” and Section 2.4.4, “Installing and Using the MySQL Preference Pane” to simplify the management of your installation.
For additional information on using MySQL on macOS, see Section 2.4.1, “General Notes on Installing MySQL on macOS”.