How to install MySQL on Windows
I'm a big fan of MySQL.
The community edition of the MySQL server, as the open-source database is formally known, is a popular choice for both development and deployment because it checks all the right boxes:
- It's open source.
- It's actively maintained.
- It's GPL-licensed.
- It's standards-based.
- Its system requirements are minimal.
Furthermore, it's relatively easy to install the MySQL database on a Windows machine. It's also simple to set up MySQL on your preferred version of Linux.
How to install MySQL on Windows
To install MySQL on Windows, simply follow these steps:
- Download the MySQL Community Edition installer.
- Open the MySQL installer and choose a full installation.
- Provide a password for the admin account when asked.
- Accept the remaining defaults and click Finish when done.
During the installation you can change the port number on which the MySQL database runs, but it's best to just stick to the default, Port 3306. That's where other applications expect it to run.
MySQL Windows service
Furthermore, you can choose to run MySQL as a Windows service, which causes MySQL to start every time you reboot your machine.
The MySQL database on Windows is lightweight, and its impact on performance is minimal. Nevertheless, if you want to conserve memory and clock-cycles, you can turn off the Windows MySQL service and start MySQL from the command line when needed.
MySQL Server and components
When you choose a full MySQL install on Windows, the following components will be installed:
- The MySQL Server -- the core of the database.
- MySQL Workbench to view your databases and schemas.
- MySQL Shell to issue SQL statements on the command-line.
- MySQL Router to help with database scaling.
- The MySQL Documentation.
- Some pre-populated database tables to play with.
After the database is installed, a good smoke test is to open the MySQL Workbench.
With this, you can validate your credentials, verify the database is running, and run queries and issue SQL statements to ensure the database is working correctly.
When the smoke test is complete, you're ready to configure the database for development or prepare it for enterprise deployment.
Database development with Java, C++ and Python
Developers often install MySQL to support database development with technologies including Hibernate, SQLAlchemy, or even Open Database Community queries. However, you need to download a separate driver to connect a Java, Python or C++ app to MySQL. The database drivers are no longer part of the basic installation.
The MySQL database drivers are available from the MySQL site's downloads page and can be manually added to any Python or Java app. However, an approach that's more compliant with 12-Factor App is to specify the required driver in Maven POM file or a Python requirements TXT file.
Cameron McKenzie has been a Java EE software engineer for 20 years. His current specialties include Agile development; DevOps; and container-based technologies, such as Docker, Swarm and Kubernetes.