How to Install MySQL on macOS

Run your own database on your mac

MySQL's GUI Client Running on macOS

MySQL.com/Oracle Corp.

Installing the MySQL database on macOS is much like installing it on Windows 10. You're likely doing it for the same reasons, including self-learning, maintaining your structured data on your own machine, or learning various types of programming. With that said, let's jump right into how to install MySQL on macOS Mojave.

Instructions in this article focus on macOS Mojave, although the steps should be similar when installing the latest version of MySQL on the latest version of macOS.

How to Download MySQL for macOS

  1. Select Downloads in the main navigation, then select Community Edititon in the sub-menu.

    Select the Community Version of MySQL Within the Downloads Section of the Site.
  2. Select MySQL Community Server.

  3. Scroll past the documentation links to the bottom section and select Download to the right of macOS 10.14 (x86, 64-bit), DMG Archive.

    Download the DMG Installer for MySQL.

    The Mac installer doesn't give you a lot of the extras. If you want documentation, sample databases, or a GUI DB explorer, you'll need to hunt them down yourself.

  4. Next you'll see buttons to either log into your Oracle Web account, or sign up for a new one. Select No thanks, just start my download.

    Click the
  5. Once your download is finished, you're ready to start the installation.

How to Install MySQL on macOS

The DMG archive for MySQL contains a nice, wizard-style installer. To install MySQL, take the following steps:

If you want to install MySQL on an older macOS version, you could use one of the macOS open source package managers, including Homebrew or MacPorts. In particular, Homebrew seems to have a very recent version of MySQL, but will install it on Mojave, High Sierra, or even Sierra.

  1. Double-click the .DMG file to open it.

  2. Inside, double-click the PKG installer.

    The MySQL DMG Archive Contains a PKG Installer.

    

  3. The installer will initially let you know it will check for prerequisites. Click Continue to start.

    The Installer Will Make Sure You Can Run MySQL Before Proceeding.
  4. The first step of the install contains some links to MySQL-related info, such as the documentation. Click Continue.

  5. Next, you'll need to accept the software's license, which is the GNU Greater Public License, or GPL. Since MySQL is open source software, it basically says you won't take this free resource and try to make something from it you also don't release for free. Click Continue, then click Agree to move on.

    Agree to the GNU General Public License, Because MySQL Is Open Source.
  6. The fourth screen asks if you want to change the install location. By default, this is your machine's "main" hard drive (i.e. the drive where macOS is installed). If you have a fancy setup with other drives, click Change Install Location... to place the software elsewhere. For most of us, click Install to proceed.

    You're Generally OK Accepting the Default Install Location.

    The install includes a command-line client; it's way down in "/usr/local/mysql/bin." What's more, this might not be added to your path variable, meaning you'll need to enter the full path in order to run it.

  7. The installer will ask for your password to move forward. Enter it, then click Install Software.

    Provide Your Password So MySQL Can Install Its Server Application.
  8. Now the install will finally start. Copying the files to your machine should be fairly quick.

    The Actual Installation of the MySQL Files Is Pretty Quick.
  9. The next thing you'll do is configure some parts of the server. The first asks for your password type. You're good to click Use Strong Password Encryption here, then click Next.

    The Final Step of the Install Is Some Configuration.

    The other option is to support older versions but also opens the door for you to select a weak password.

  10. Finally, you'll be asked for a MySQL root password. The root user is the superuser of the MySQL subsystem. Click Finish when you're done.

  11. The last screen displays a summary and some links again. Installation complete!

How to Run MySQL on macOS

Your first instinct to run MySQL after installation might be to open the Applications menu, but MySQL is a server application, so you won't find it there.

You'll need to dig into the technical details for MySQL to be of much use to you. Be sure to brush up on the fundamentals of SQL.

  1. Click the Apple logo in the top left corner of the screen, then click System Preferences.

  2. Click MySQL to launch it.

    MySQL Is Located Not in the Applications Folder, But in System Preferences.

    The MySQL database server runs on port 3306 by default. If you plan on connecting to the database from another machine, you may need to adjust your firewall.

  3. From here, there are various things you can do:

    • Click the Start MySQL Server button to Start and stop the server.
    • Choose whether you want the server to run automatically at start-up.
    • Click Initialize Database to reconfigure the default database.
    • Uninstall MySQL.
  4. Click the Configuration tab to set advanced options, including data directories, the location of the error log, or a custom configuration file, if you have one.

    The MySQL Configuration Panel Gives You Access to Advanced Options.
  5. You're done!