Education

How to install MySQL Shell on Your Mac

Mila
2 min read

MySQL Shell is an interactive JavaScript, Python, or SQL interface for MySQL Server and is a component that you can install separately. It can be installed on your Mac by using Homebrew or the official MySQL Shell package.

Homebrew

To install MySQL Shell using Homebrew, you need to install Homebrew on your Mac first. If you aren’t sure if you have installed Homebrew already, open your terminal and run the following command to check.

brew -v

If you have, the terminal will display something like this:

_

Otherwise, run the following command to install Homebrew first:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

On successful installation, your terminal will return a few new lines, with one of them stating:

==>Installation successful!

Install MySQL Shell

To install MySQL Shell using Homebrew, run the following command in the terminal:

brew install --cask mysql-shell

The installation will start shortly. You will know it's done when your Terminal returns the following lines:

🍺  mysql-shell was successfully installed!

Start MySQL Shell to verify the installation.

mysqlsh

This output indicates that the installation was successful.

MySQL Shell version

Copyright (c) 2016, 2022, Oracle and/or its affiliates.
Oracle is a registered trademark of Oracle Corporation and/or its affiliates.
Other names may be trademarks of their respective owners.

Type '\help' or '\?' for help; '\quit' to exit.
 MySQL  JS >

MySQL Shell package

The second way is to download the MySQL Shell for the macOS package.

Select the corresponding Operating System and OS Version of your Mac, and download the package.

_

Double-click the downloaded DMG file, a Finder window will show up.

_

Double-click to extract the .pkg file, and then follow the instructions as shown in the installation wizard.

_

When the installer finishes, it means you have successfully installed MySQL Shell for Mac, feel free to eject the DMG and delete the file.

Start MySQL Shell to verify the installation.

mysqlsh

This output indicates that the installation was successful.

MySQL Shell version

Copyright (c) 2016, 2022, Oracle and/or its affiliates.
Oracle is a registered trademark of Oracle Corporation and/or its affiliates.
Other names may be trademarks of their respective owners.

Type '\help' or '\?' for help; '\quit' to exit.
 MySQL  JS >

Starting MySQL Shell

You can start MySQL Shell using this command:

mysqlsh

This will start MySQL Shell in JavaScript mode (by default). To connect to a server, check out MySQL Shell Connections.