Skip to content

Instantly share code, notes, and snippets.

@jonjack
Last active November 15, 2023 11:44
Show Gist options
  • Star 16 You must be signed in to star a gist
  • Fork 5 You must be signed in to fork a gist
  • 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              mysql@5.7
mysql                        mysql-cluster                mysql-sandbox                mysql@5.5                    mysqltuner
mysql++                      mysql-connector-c            mysql-search-replace         mysql@5.6

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

Install a version.

brew install mysql@5.7
==> Installing mysql@5.7
==> Downloading https://homebrew.bintray.com/bottles/mysql@5.7-5.7.23.high_sierra.bottle.tar.gz
######################################################################## 100.0%
==> Pouring mysql@5.7-5.7.23.high_sierra.bottle.tar.gz
==> /usr/local/Cellar/mysql@5.7/5.7.23/bin/mysqld --initialize-insecure --user=jjackson --basedir=/usr/local/Cellar/mysql@5.7/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 mysql@5.7 now and restart at login:
  brew services start mysql@5.7
Or, if you don't want/need a background service you can just run:
  /usr/local/opt/mysql@5.7/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!
@LiamYaoLian
Copy link

LiamYaoLian commented Mar 21, 2021

For me, it's not working.
MySQLWorkbench comes under Applications, after opening it, it says "MySQLWorkbench quit unexpectedly.
...
...
the latest version of workbench has a bug, try https://downloads.mysql.com/archives/workbench/ for version:8.0.21, that will work on your mac

@sangam3101
Copy link

That worked like a charm, thank you!

@OmanyeMensah
Copy link

i am getting issue with starting mysql. i keep getting the below error:
Apples-MacBook-Pro:bin apple$ mysql -uroot
-bash: mysql: command not found

@artodeschini
Copy link

thanks

@newtella
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