Skip to content

Instantly share code, notes, and snippets.

@jonjack
Last active November 15, 2023 11:44
Show Gist options
  • Save jonjack/37ce2d0a28fc53d85d7c18de8065d555 to your computer and use it in GitHub Desktop.
Save jonjack/37ce2d0a28fc53d85d7c18de8065d555 to your computer and use it in GitHub Desktop.

Install MySQL

See what formula are available.

brew search mysql
==> Formulae
automysqlbackup              mysql-client                 mysql-connector-c++          mysql-utilities              [email protected]
mysql                        mysql-cluster                mysql-sandbox                [email protected]                    mysqltuner
mysql++                      mysql-connector-c            mysql-search-replace         [email protected]

==> Casks
mysql-connector-python  mysql-shell             mysql-utilities         mysqlworkbench          navicat-for-mysql       sqlpro-for-mysql

Install a version.

brew install [email protected]
==> Installing [email protected]
==> Downloading https://homebrew.bintray.com/bottles/[email protected]_sierra.bottle.tar.gz
######################################################################## 100.0%
==> Pouring [email protected]_sierra.bottle.tar.gz
==> /usr/local/Cellar/[email protected]/5.7.23/bin/mysqld --initialize-insecure --user=jjackson --basedir=/usr/local/Cellar/[email protected]/5.7.23 --datadir=/usr

MySQL is configured to only allow connections from localhost by default

To connect run:
    mysql -uroot
    
To have launchd start [email protected] now and restart at login:
  brew services start [email protected]
Or, if you don't want/need a background service you can just run:
  /usr/local/opt/[email protected]/bin/mysql.server start

MySQL is configured to only allow connections from localhost by default

To connect run:
    mysql -uroot

Install Workbench (Pre-Catalina)

If on Catalina then skip to next section. ๐Ÿ‘‡

brew install --cask mysqlworkbench
==> ==> Downloading https://downloads.mysql.com/archives/get/p/8/file/mysql-workbench-community-8.0.23-macos-x86_64.dmg
######################################################################## 100.0%
==> Verifying checksum for Cask mysqlworkbench
==> Installing Cask mysqlworkbench
==> Moving App 'MySQLWorkbench.app' to '/Applications/MySQLWorkbench.app'.
๐Ÿบ  mysqlworkbench was successfully installed!

You should see MySQLWorkbench under Applications

Guidelines for Catalina

The current version of mysqlworkbench (8.0.23) for Catalina at time of writing (June 2021) is 8.0.23 which appears to be buggy for certain updates of Catalina. Dropping down one version to 8.0.22 worked for me as follows.

If already installed then remove first.

brew uninstall --cask mysqlworkbench

Download formula for 8.0.22.

wget https://gist.githubusercontent.com/jonjack/de51fb456c7682cbfd55314669d6513c/raw/4b70352469035a2e35818f2c1fff0e1cb1bbec89/mysqlworkbench-8.0.22.rb

Now install.

brew install --cask mysqlworkbench-8.0.22.rb

==> Downloading https://downloads.mysql.com/archives/get/p/8/file/mysql-workbench-community-8.0.22-macos-x86_64.dmg
==> Downloading from https://cdn.mysql.com/archives/mysql-workbench/mysql-workbench-community-8.0.22-macos-x86_64.dmg
######################################################################## 100.0%
==> Installing Cask mysqlworkbench-8.0.22
==> Moving App 'MySQLWorkbench.app' to '/Applications/MySQLWorkbench.app'
๐Ÿบ  mysqlworkbench-8.0.22 was successfully installed!

Big Sur

There is also a formula here which will install v8.0.25 compatible with Big Sur.

wget https://gist.githubusercontent.com/jonjack/84e24ed5f44e452e629cfe01cf472267/raw/987362b8bd554b49ecc136213321d5f27c89efb0/mysqlworkbench-8.0.25.rb

brew install --cask mysqlworkbench-8.0.25.rb
==> Downloading https://cdn.mysql.com/Downloads/MySQLGUITools/mysql-workbench-community-8.0.25-macos-x86_64.dmg
######################################################################## 100.0%
==> Installing Cask mysqlworkbench-8.0.25
==> Moving App 'MySQLWorkbench.app' to '/Applications/MySQLWorkbench.app'
๐Ÿบ  mysqlworkbench-8.0.25 was successfully installed!
@buildwithraven
Copy link

Just a small update for Big Sur users.

After executing:
wget https://gist.githubusercontent.com/jonjack/84e24ed5f44e452e629cfe01cf472267/raw/987362b8bd554b49ecc136213321d5f27c89efb0/mysqlworkbench-8.0.25.rb

  1. Open the file and change the url to https://downloads.mysql.com/archives/get/p/8/file/mysql-workbench-community-8.0.25-macos-x86_64.dmg and save it.

  2. Then use brew install mysqlworkbench-8.0.25.rb

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment