How to Install MySQL on Mac
October 26, 2023
This guide walks you through how to install MySQL on a macOS system using either the DMG archive and the Compressed TAR archive.
- A Mac running macOS.
- Administrative access to the Mac.
1. Download MySQL for Mac
You can download the MySQL Community Server for macOS from the official MySQL website.
- 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
- Open the DMG archive that you've just downloaded.
- Inside the DMG archive, you'll find the MySQL installer package (
.pkgfile). Double-click on it to initiate the installation process.
- Follow the on-screen instructions. When prompted, provide your administrative password to continue.
- 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:
Navigate to the directory where the TAR file was downloaded.
Extract the TAR archive using: Replace
xxxxxwith the actual file name.
Navigate into the extracted directory:
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:
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:
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:
When prompted, enter the root password you set during the secure installation process.
You can also connect to a cloud-based tool like Basedash if you want to safely share access with teammates. Basedash also lets you build more powerful admin panels and dashboards in a few minutes.
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.
How to Resolve MySQL Error Code 1055
Best ETLs for MySQL
BigQuery vs MySQL: A Comprehensive Guide
Migrating from BigQuery to MySQL
MySQL Output Formatting
How to Disable Safe Mode in MySQL