Step by step guide to download MySQL for Windows and macOS using different methods:
In this tutorial, we will learn the different ways/approaches to see how you can download MySQL and start using it within a couple of minutes.
MySQL can be downloaded as a standalone installer for different operating systems, or as a zipped image/archive and the easiest one is using docker for MySQL if you just want to learn and explore MySQL.
Also, please note that MySQL is available as a community (free) and enterprise (paid) edition to download.
=> Click here for the complete MySQL tutorial series
For most practical purposes mySMySQLQL installation through installer and docker image solve most of the use cases. We will see both these approaches for Windows and Mac-based Operating Systems here.
Table of Contents:
MySql Download Through Installer
MySQL is available to download as a standalone package installer for both Windows and macOS.
Let’s see the details for each of these.
Installing MySQL On Windows
a) Prerequisites: Before starting the installation process, please note that MySQL Installer requires .NET Framework 4.5.2 (If you have an older version of the .NET framework, then update that in order to begin the installation process).
b) Download MySQL community installer from the source here. (The current version of MySQL while writing this tutorial is 8.0.20. If you need to download a specific version of MySQL, then you can refer to the respective installer here and choose the version that you wish to install).
Choose the installer depending on whether the Windows version you are using is 32bit or 64bit (you can refer the link here to know the version of OS that you are using).
c) After downloading the installer, open the installer exe and continue with the instructions. Please note that you will require an active internet connection as the installer is a shell and it downloads the selected products over the internet once chosen during the installation process.
For choosing the configuration, you can choose the ‘Developer Default’ that takes care of almost all the required stuff for development/testing needs.
d) Once the setup is complete, if you have chosen to install the client for MySQL (MySQL Workbench which is Community/free download), then you can connect your server instance, else you can check the installation from the command line by executing the command below.
C:\> "C:\Program Files\MySQL\MySQL Server 8.0\bin\mysql" test
Installing MySQL On MacOS
#1) For installing/downloading MySQL on macOS through disk image (.dmg) or installer – download the disk image file for the community edition from here
#2) Once the dmg file is downloaded, double click to mount the disk image and start the installation process by following the instructions in the install package. Follow the below screenshots for the step-by-step installation process.
#3) Once the installation is complete, in order to turn on the MySQL server, you can open MySql preferences and turn on the MySQL server if not turned on already.
Open the System preferences and click on the MySQL icon.
The MySQL preferences pane will open now and you can see the status of the MySQL server. If it’s not already running, then you can turn on the server from there.
#4) Now let’s check whether our installation is successful or not by checking the version from the command line. Open the terminal prompt and navigate to the MySQL install directory which is by default
/usr/local/mysql/bin
Run the below command to check the version.
./mysql -V
If you see the output lias below, then it means that your installation was successful.
./mysql Ver 8.0.20 for macos10.15 on x86_64 (MySQL Community Server - GPL)
#5) In order to use MySQL from the command line, you can continue using the command line or terminal (with the password that was set during the install process) or download MySQL client applications like MySQL Workbench to access via GUI.
Let’s explore a few command-line options. To get started with MySQL shell, run the below commands.
./mysql -u root -p
Now, you would be prompted for the password (You need to enter the one that was entered during installation – suppose you set the password as ‘password’), then at the password prompt enter the password. Once the authentication is successful, the user would log in to the MySQL shell.
Let’s try running a sample command to see if the shell is working correctly or not. Execute the below command on the MySQL shell.
SHOW DATABASES;
You should be able to see the below output for the command.
MySQL Docker Image
Installing MySQL through a docker image as a docker container is the easiest approach if you just want to learn MySQL and don’t want to install the full software/server on your system.
Docker lets you quickly spin up, turn on and turn off the containers that contain the required software which in this case is the MySQL server.
Let’s see the steps that would be required to install MySQL as a Docker image.
#1) In order to use Docker image, you would require to install Docker based on your OS. In order to install Docker, follow the instructions here
#2) Once the Docker engine is installed, we would need to download (or pull) the Docker image from the Docker hub. Let’s see the command that can be used to pull the Docker image for the Community server edition.
Execute the below command on the terminal or command prompt.
docker pull mysql/mysql-server:tag
Here, the tag represents the version of the MySQL Community Server edition that you want to download. If you are not looking for a specific version, then you can simply omit the tag details and run the command below (This would fetch the image for the latest available edition of the MySQL Community Edition).
docker pull mysql/mysql-server
#3) Once the Docker image is downloaded, we can try listing the images, and see if we can find a MySQL image in the list that gets displayed. Run the below command in the terminal (for Linux based systems).
docker image ls | grep "mysql-server"
If you see the output like below, then that would mean that your Docker image was downloaded successfully.
#4) Now let’s run a container against the Docker image that we just downloaded. We would name the container as ‘’mysql-docker-demo”. Run the below command to start the container from the image.
docker run --name="mysql-docker-demo" -d mysql/mysql-server
#5) Now, in order to obtain the password that’s set while running the Docker container, we can fetch the details from the Docker logs and then restart this password using the ALTER command.
Execute the following command on the terminal:
docker logs mysql-docker-demo 2>&1 | grep GENERATED
Please note that ‘mysql-docker-demo’ in the command above is the name of the docker container. If you’ve named the container differently then you would need to replace it with the container name.
If your Docker container is started properly, then you would see the output as shown below.
[Entrypoint] GENERATED ROOT PASSWORD: *ovIDej0cNAr[apq0jWuf4KdOpI
#6) We would now login to the mysql shell in the Docker container with the generated password.
Execute the below command.
docker exec -it mysql-docker-demo mysql -u root -p
When prompted for a password, enter the one from Step #5 above. Once, entered you would be logged in to the MySQL client within the Docker container.
At this time, if you enter a command like SHOW DATABASES; then it would throw an error and ask to update/change the default password.
mysql> SHOW DATABASES; ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
#7) Let’s now reset the password using the ALTER command.
ALTER USER ‘root’@’localhost’ IDENTIFIED BY ‘password’;
Here ‘password’ is the actual password that you want to set for the root user. You can change it to any value as appropriate and desired.
#8) Now we will try running a simple command to validate our installation. We would run the command SHOW DATABASES; to get the details of all the available databases.
Here’s the command output
mysql> show DATABASES;
+——————–+
| Database |
+——————–+
| information_schema |
| mysql |
| performance_schema |
| sys |
+——————–+
4 rows in set (0.00 sec)
#9) With this, we have now successfully started the Docker container having MySQL installation and this could now be used for running any MySQL commands – just like how you do with installation on a local machine.
You could also start/stop the Docker container on-demand as and when required.
To stop the MySQL docker container, you could use the below command.
docker stop mysql-docker-demo
To start the Docker container back, you could use the below command.
docker start mysql-docker-demo
MySQL Enterprise Edition
MySQL is an open-source database that is used widely.
The Enterprise edition is owned by Oracle and it includes a suite of tools and features that comes with the paid version only (The free version is the MySQL Community edition).
MySQL Enterprise Edition is available over Oracle cloud as a fully managed service.
Some estimates around costing of MySQL Enterprise edition is given below:
Edition | Annual Subscription (USD) |
---|---|
MySQL Standard Edition | 2000 - 4000 |
MySQL Enterprise Edition | 5000 - 10000 |
Check Oracle Costing Sheet for more information.
MySQL Paid versions come with technical support and assistance from the MySQL team as well as with other monitoring tools like Backup, Encryption, Firewall, etc.
Frequently Asked Questions & Answers
Q #1) Is MySQL free to download?
Answer: MySQL is available in multiple editions. The community edition is free to download and use while the other variants like MySQL Standard and MySQL Enterprise editions have an annual subscription cost attached as they come with cloud support and technical assistance from the MySQL team.
In order to use MySQL open source for commercial purposes, you can use MariaDB which is based on MySQL database.
Q #2) How to install MySQL Client?
Answer: MySQL Client is downloaded as a part of the standard installation of the MySQL server. MySQL client can be started from the terminal or command prompt by navigating to the directory as mentioned below for Mac/Linux or Windows.
MAC - /usr/local/mysql/bin WINDOWS - C:\\Program Files\\MySQL\\MySQL Server 8.0
The MySQL command-line client can be started by running the MySQL executable in the above directories.
For using a GUI based client, you can download MySQL workbench here by choosing the appropriate OS combination.
Q #3) How do I download MySQL for Windows?
Answer: MySQL is available for almost all the major operating systems like macOS, Linux & Windows. For Windows, it could be downloaded as an executable or zip.
Refer to the download details here on the MySQL official download page.
We have listed down the complete installation steps for downloading/setting up and installing MySQL Community Server edition on Windows here in this tutorial.
Conclusion
In this tutorial, we learned about the various ways through which you can download MySQL on your desktop/laptop with different operating systems.
We discussed on validating the installation of the MySQL Community Server on Windows and macOS platforms. We also learned about using Docker to get started with the MySQL Server development and came to know how to quickly get started with MySQL server.
Hope this tutorial clarified all your queries on Downloading MySQL.