How to install MySQL on Windows for app development

A relational database underpins every modern enterprise architecture. As such, programmers need a local database installation for development, experimentation and testing before code is sent into production.

The MySQL Community Server -- as the open source database is formally known -- is an excellent choice for local development because it is a popular, lightweight, open source database with an abundance of users to provide online support through various forums and discussion boards. The community server can also be packaged with a variety of developer tools which can help simplify database management and administration.

Let's explore how easy it is to install MySQL on Windows and examine the following three important MySQL developer tools:

  1. The MySQL Workbench
  2. The MySQL Shell
  3. Connector/J -- the MySQL JDBC driver

How to install MySQL on Windows with custom features

Developers can download the database and all of the associated MySQL tools as a single product install from the MySQL development website. Don't choose each product individually. Instead, use the 420 MB MySQL Installer for Windows. The latter option will allow a developer to install MySQL on Windows with all the developer tools at the same time as part of a custom installation.

install MySQL tools
When you install MySQL community server, be sure to also install MySQL developer tools such as the Workbench, Shell and Connector/J.

As you install MySQL on Windows, the program will automatically choose C:\Program Files as the default directory. However, I prefer to install it into an alternate folder where the binaries are easier to access. Also, it's a best practice to avoid using folder names that contain spaces as it can cause runtime errors in software scripts that are tedious to troubleshoot. For my local installation, I changed the default MySQL install directory to C:\_mysql.

MySQL JDBC driver installation

After the MySQL install wizard completes, open the file system explorer and confirm that the MySQL JDBC drivers were saved under the Connector/J subfolder. This JAR file will contain the following two JDBC drivers:

  • mysql.cj.jdbc.Driver (new development)
  • mysql.jdbc.Driver (for legacy JPA, Hibernate and JDBC development support)

The cj driver is recommended for all new JDBC development, while the legacy driver can be used for backward compatibility with older systems.

The ConnectorJ JAR file is one of the MySQL tools developers should install along with the database server.

The MySQL Workbench developer tool

A developer can verify that the MySQL install was successful by trying to connect to the database server with the Workbench tool. If the MySQL Workbench can connect on port 3306 and it's possible to browse the tables under the default schema named sys, then the database is running locally, and you have successfully installed MySQL on Windows.

MySQL Workbench tool
The ability to use the MySQL Workbench tool confirms the veracity of the MySQL install.

If connectivity with the MySQL tool is successful, you know that the database is indeed running locally, which means the MySQL install on Windows was successful. And with the JDBC drivers at the ready, you're all set to boot up your favorite IDE and start database driven application development and testing.

View All Videos