MySQL is an open-source relational database management system (RDBMS) that uses Structured Query Language (SQL) to manage, manipulate, and retrieve data stored in relational databases. It is widely used for web applications and acts as a database component of the LAMP (Linux, Apache, MySQL, PHP/Perl/Python) stack, known for its reliability, scalability, and ease of use.
Installation
Installation of the MySQL Community Server and the Workbench IDE tool are multi-step processes. The Community Server is the MySQL database engine that runs as a background process on your computer. Once installed, you can interact with it either through a set of commandline tools, with an IDE, with programming languages like Python, Java, C++, C#, etc., or using software such as Excel, Tableau, Power BI, etc.
To begin downloading and installing the Community Server and the Workbench IDE, select your operating system tab below for OS-specific instructions:
Choose your operating system for detailed installation instructions.
The following instructions were written using Windows 10. If you have a previous version of Windows these instructions should still work, however there may be some differences.
Instructions
First, in a web browser navigate to this address: https://dev.mysql.com/downloads. The following screen will appear. We will download and install the two components from this page. We will start with MySQL Community Server and then return to this screen after the server is installed to install the Workbench tool.
When we click on the MySQL Community Server link the following screen appears. Your Windows operating system should be automatically detected and appear in the Operating System drop-down list. If it does not, drop the list down and select your operating system.
There are several options that we can use to download a copy of the MySQL installer. For the purposes of these instructions we’ll look at an example that is commonly used to set up MySQL for a development computer, that is, a computer used by a programmer to work with a database for development and/or testing tasks.
With the correct operating system selected (Microsoft Windows in the above example), click the Go To Download Page > button (outlined in red on the screen capture). The other two Download buttons would also work; however they also require deeper knowledge of installation. So, we’ll use the straightforward options and do a minimal installation to safe on disk space.
The next page that appears allows us to choose an MSI installer. We will click the first Download button (outlined lined in red on the screen capture below):
On the next page, if you have an account with Oracle you can login next. However, an account is not required. To avoid having to create an account, click the No thanks, just start my download link.
When the download finishes, we can either click the downloaded button at the bottom-left of the browser or double-click the .msi file in our Downloads folder.
The installer dialog opens. For our purposes, to keep the installation as small as possible and only install parts of MySQL we need.
Select the Server Only option and click the Next button.
Click Next on the next dialog as well.
And then on the next dialog click the Execute button to launch the installation process.
Continue clicking Next and accepting the default settings until you reach the Accounts and Roles dialog.
By default, the installer will create an administrator account in MySQL called root. This account is what you will use to manage your database server. The Accounts and Roles dialog prompts you for a password for the root user account.
In a real business server, we would use a highly cryptic and secure password for the root user. In our case though, you can user a simple password that you will remember.
After entering a password click the Next button.
On the next dialog accept the defaults and click the Next button.
On the next dialog when we click the Execute button the installation will launch.
When the installation completes on the last dialog click the Finish button.
You will not see anything on your computer screen because the MySQL database engine runs in the background.
Next, we will install MySQL Workbench, which is the graphic user interface we will use to work with our database.
After the installation return to your browser and Click the MySQL Community Downloads link at the top of the screen.
You will then be back to the original Downloads page seen below.
On the next page, if you have an account with Oracle you can login next. However, an account is not required. To avoid having to create an account, click the No thanks, just start my download link.
Next, click the MySQL Workbench link to start the download process of the workbench tool.
The workbench download page will appear. It should auto-detect your operating system, as seen in this example, Microsoft Windows has been automatically set.
If your operating system is not shown correctly, use the drop-down to select your OS from the list.
If you see the account page again and you have an account with Oracle you can login next. However, an account is not required. To avoid having to create an account, click the No thanks, just start my download link.
When the download finishes, we can either click the downloaded button at the bottom-left of the browser or double-click the .msi file in our Downloads folder.
The following 5 screen captures depict the steps for installing Workbench.
Click Next:
Click Next:
Click Next:
Click Intall:
Click Finish
When MySQL Workbench launches, you’ll see the Welcome page that displays our Local instance 3306 (your connection number may be different) connection.
When we click the Local instance 3306 we see a prompt for the root account password.
Entering the root account password that we established at the beginning of these instructions open the MySQL Workbench interface. From here we can create and manage databases (schemas), write queries, etc.
Last step will be to change one setting that we will need later. We will set it now, so we won’t have to worry about it later.
In Workbench, on the top menu click the Edit menu, and then Preferences. The preferences dialog will look like this:
Then click the SQL Editor option at the top of the list of options on the left-side of the dialog.
The SQL Editor options will open. At the bottom of the settings (you might need to scroll down), uncheck the Safe Updates checkbox. Then click the Ok button. This setting will prevent some confusing error messages you would encounter later in the course.
MySQL and MySQL Workbench are now installed and ready for use.
Note: If you are going to interact with MySQL from a programming language (C, C++, C#, Java, Python, etc.) or other software (Excel, Tableau, Power BI, etc.) you will need a connector (often referred to as a driver). See the Connectors section at the bottom of this page for instructions.
The following instructions were written using Mac OS Big Sur. If you have a different version of Mac OS these instructions should still work, however there may be some differences.
Instructions
First, in a web browser navigate to this address: https://dev.mysql.com/downloads. The following screen will appear. We will download and install the two components from this page. We will start with MySQL Community Server and then return to this screen after the server is installed to install the Workbench tool.
When we click on the MySQL Community Server link the following screen appears. Your Mac operating system should be automatically detected and appear in the Operating System drop-down list. If it does not, drop the list down and select your operating system.
Be sure the correct operating system is selected (macOS in the above example). The easiest download option is usually dmg, so select that option and click the Download button.
If you have an account with MySQL you can login next. However an account is not required. To avoid having to create an account, click the No thanks, just start my download link.
When the download completes, you’ll find the downloaded install file in your Downloads folder. Next, double-click the .dmg file to start the installation of MySQL server.
The MySQL package will appear on your desktop like this:
Next double-click the .pkg file to launch the installation process. The installer dialog will open next. The installer dialog will prompt you that the software will be checked for validity. Click the Continue button.
Click Continue on the next dialog as well
Click the Continue button on the license page.
On the next screen you can change the installation location of you wish. For this example we’ll accept the default and click Install.
By default the installer will create an administrator account in MySQL called root. This account is what you will use to manage your database server. The next couple of dialogs will prompt you for a password for the root user account.
In a real business server we would use a highly cryptic and secure password for the root user. In our case though, you can user a simple password that you will definitely remember, or even a blank password. If you use a blank password, be sure not to store sensitive data in your database.
For our example we’ll Use Strong Password Encryption and click Next.
On the next dialog we’ll enter a password that will be easy to remember. After entering a password click the Continue button.
The installation process will run and when it is complete the MySQL server will be running in the background because we left the Start MySQL Server once the installation is complete checkbox checked.
The Summary dialog appears and you can click the Close button.
You will not see anything on your computer screen because MySQL runs in the background.
Next, we will install MySQL Workbench, which is the graphic user interface we’ll use to work with our database.
After we close the Summary dialog we'll return to our browser and click the MySQL Community Downloads link at the top of the screen. We will then be back to the original Downloads page seen below.
This time we'll click the MySQL Workbench link.
The workbench download page will appear. It should auto-detect your operating system, as seen in this example, macOS has been automatically set.
If your operating system is not shown correctly, use the drop-down to select your OS from the list.
Note: If you are using the Macintosh Big Sur OS Version, go to the Workbench Archive Page and download Version 8.0.21 instead of the most recent version. As of May 2021, there are problems with the latest version of Workbench and Big Sur. The rest of these instructions on the following pages will be the same.
Click the No thanks, just start my download link.
When the workbench tool finishes downloading you’ll find the installer in your Downloads folder.
Double-click the dwg file and the installer will launch.
When the installation is finished you’ll be prompted to drag the MySQLWorkbench.app file into your Applications folder. You can do that directly here in this dialog.
After dragging the app you can close this dialog.
You can find the workbench tool in your Applications folder. To Start it double-click the app.
Depending on your system settings, when you try to open the MySQL Workbench app, you may see a warning about the app not being authorized to run on your system. You can bypass this warning as follows …
Open your System Preferences and navigate to Security & Privacy. On the General Tab you should see the MySQLWorkbench.app listed at the bottom as blocked. Click the Open Anyway button.
Next you’ll see another prompt as seen below. Click the Open button.
When MySQL opens, you’ll see the servers list as seen below. In this example our server is Local instance 3306.
If we click the Local instance 3306 we see a prompt for the root account password.
Entering the root account password that we established at the beginning of these instructions open the MySQL Workbench interface. From here we can create and manage databases (schemas), write queries, etc.
Last step will be to change one setting that we will need later. We will set it now, so we won’t have to worry about it later.
In Workbench, on the top menu click the Edit menu, and then Preferences. The preferences dialog will look like this:
Then click the SQL Editor option at the top of the list of options on the left-side of the dialog.
The SQL Editor options will open. At the bottom of the settings (you might need to scroll down), uncheck the Safe updates checkbox. Then click the Ok button.
This setting will prevent some confusing error messages you would encounter later in the course.
MySQL and MySQL Workbench are now installed and ready for use.
Note: If you are going to interact with MySQL from a programming language (C, C++, C#, Java, Python, etc.) or other software (Excel, Tableau, Power BI, etc.) you will need a connector (often referred to as a driver). See the Connectors section at the bottom of this page for instructions.
The following instructions were written using Linux Mint. If you have a different Linux distribution and/or version of Linux you may need to use other command line tools, but the steps will be similar.
Instructions
First, open a Terminal window.
Then use sudo -i to move to the root user account. You may need to enter the root password here. If you do not have the root password, you can try using the sudo command to proceed the commands used in the example below (like sudo apt update, etc.).
Run the apt update command:
Your system will update as needed:
Next, run the apt install mysql-server command:
MySql server installation will run:
When the installation finishes run the mysql --version command to check that the installation completed successfully:
You should see the version of MySql with no errors.
Next, run the systemctl status mysql command to check that the MySQL engine is running:
You should see that MySql is Active:
Next, we'll install the MySQL Workbench tool. Run the apt-get install mysql-workbench command.
You may be prompted Do you want to continue?, answer Y for yes:
The installation will run and complete:
Open the program list and search for "my", you should see MySQL Workbench listed now. Select the program to confirm that it will run.
You should see the main MySQL Workbench window now:
MySQL and MySQL Workbench are now installed and ready for use.
Note: If you are going to interact with MySQL from a programming language (C, C++, C#, Java, Python, etc.) or other software (Excel, Tableau, Power BI, etc.) you will need a connector (often referred to as a driver). See the Connectors section at the bottom of this page for instructions.
Connectors
After you have installed MySQL, when you want to interact with your database from a programming language (C, C++, C#, Java, Python, etc.) or other software (Excel, Tableau, Power BI, etc.) you will need a connector (often referred to as a driver). A connector is an interface that allows connections to MySQL databases from external tools. Oracle provides connectors that will work for most purposes.
Here is a list of the connectors available from the above dev download site (current as of April 2022):
C API: An API used to connect C programming language programs to MySQL.
Connector/C++: A connector used to connect C++ programming language programs to MySQL.
Connector/J: A connector used to connect Java programming language programs to MySQL.
Connector/NET: A connector used to connect .Net programming languages to MySQL.
Connector/Node.js: A connector used to connect Node.js programming language programs to MySQL.
Connector/ODBC: A general driver used to connect various software (like Excel, Tableau, Power BI, etc.) to MySQL.
MySQL Native Driver for PHP: A connector used to connect PHP programming language programs to MySQL.