Skip to content

This guide walks you through how to install MySQL on a macOS system using either the DMG archive and the Compressed TAR archive.

Prerequisites

  • A Mac running macOS.
  • Administrative access to the Mac.

Installation Steps

1. Download MySQL for Mac

You can download the MySQL Community Server for macOS from the official MySQL website.

URL: https://dev.mysql.com/downloads/mysql/

  • Navigate to the website.
  • Choose the macOS version.
  • You’ll have two primary options for downloading:
    • DMG Archive: This is a graphical installer.
    • Compressed TAR Archive: This is a compressed file that can be extracted and installed via the terminal.

2. Install MySQL Using DMG Archive

  1. Open the DMG archive that you’ve just downloaded.
  2. Inside the DMG archive, you’ll find the MySQL installer package (.pkg file). Double-click on it to initiate the installation process.
  3. Follow the on-screen instructions. When prompted, provide your administrative password to continue.
  4. After the installation completes, the installer may also prompt you to install Preference Pane and MySQL Workbench. Choose according to your needs. (Preference Pane allows easier start/stop of the MySQL server from System Preferences).

3. Install MySQL Using Compressed TAR Archive

If you opted to download the TAR archive:

  1. Navigate to the directory where the TAR file was downloaded.

  2. Extract the TAR archive using: Replace xxxxx with the actual file name.

    tar -xzf mysql-xxxxx.tar.gz
    
  3. Navigate into the extracted directory:

    cd mysql-xxxxx
    
  4. Install MySQL by following the provided instructions, typically found in a README or INSTALL file.

4. Start MySQL on Mac

Once you’ve installed MySQL using either method, you can start the MySQL server using the following command:

sudo /usr/local/mysql/support-files/mysql.server start

Enter your Mac’s administrative password when prompted.

Alternatively, if you installed the Preference Pane using the DMG method, you can navigate to System Preferences > MySQL and start/stop the server from there.

5. Secure MySQL Installation

It’s crucial to run the mysql_secure_installation script to enhance the security of your MySQL installation:

/usr/local/mysql/bin/mysql_secure_installation

You’ll be guided through a series of prompts to:

  • Set a root password.
  • Remove anonymous users.
  • Disallow root login remotely.
  • Remove test database and access to it.
  • Reload privilege tables.

6. Connect to MySQL Server

You can connect to the MySQL server using the command-line client with:

/usr/local/mysql/bin/mysql -u root -p

When prompted, enter the root password you set during the secure installation process.

Basedash is built as an AI-native BI platform, so teams can go from ad hoc SQL to trusted answers and dashboards quickly, without the overhead of traditional BI setup.

Conclusion

You’ve successfully installed MySQL on your Mac using either the DMG archive or the Compressed TAR archive! For more detailed configurations and troubleshooting, refer to the official MySQL documentation. Remember to periodically check for updates and patches to ensure you’re running a secure and efficient MySQL server.

Written by

Robert Cooper avatar

Robert Cooper

Senior Engineer at Basedash

Robert Cooper is a senior engineer at Basedash who builds full-stack product systems across SQL data infrastructure, APIs, and frontend architecture. His work focuses on application performance, developer velocity, and reliable self-hosted workflows that make data operations easier for teams at scale.

View full author profile →

Looking for an AI-native BI tool?

Basedash lets you build charts, dashboards, and reports in seconds using all your data.