Install MySQL database on windows is easy, rather than install software like wamp or xampp that comes with a lot of other stuff that probably you don't need. You can only install MySQL database on your windows machine it may be windows 10 or even Windows 7. So in this tutorial, I'm going to show you how to install MySQL on Windows 10.
1. Download MySQL
The first thing to do is to go to dev.mysql.com and click on the DOWNLOADS from the menu, it will redirect you to a downloads page where you'll find various versions of MySQL, we are not interested in enterprise versions instead we want just the community one. That's why you should choose the MySQL Community (GPL) Downloads » which again will redirect you to a page where you'll find different types of MySQL, but here we are interested in MySQL database that's why you have to click on the link MySQL Installer for Windows just like the screen below:
Once you click on that link you'll be redirected to another page where you have to choose what operating system and also it will offer two different versions of the installer :
(mysql-installer-web-community-188.8.131.52.msi) Which will download all needed files at the moment of installation, that's why it's only 2.5M.
(mysql-installer-community-184.108.40.206.msi) Which is very heavy because it's an installer that downloads all needed files at once, that's why it's only 405.2M.
For I'm gonna choose the heavy one mysql-installer-community-220.127.116.11.msi.
2. Install MySQL
Once the msi file is downloaded double click on that file to run the installation.
choosing a setup type
You have a various setup types to choose, if you let the default one Developer Default it will install all products needed for MySQL development purposes like MySQL Server, MySQL Shell, MySQL Router, MySQL Workbench..., but we don't really need all those products we only want MySQL database that's why you have to choose the Custom setup:
This setup allows you to select exactly which products you would like to install. This also allows picking other server versions and architectures (depending on your OS).
Select products and features
Now we will select only MySQL Servers just like the screens bellow:
If you are interested in other applications like MySQL workbench that let you visualize your database or other applications you can install them as well.
We are gonna stay simple and click next button.
You can see that MySQL server is ready to be installed, so let's do that and hit the Execute button. once the installation is completed click on the Next button to move to the product configuration.
We are gonna let everything as it is by default, the only thing we need to change is to unselect the Open Windows Firewall port for network access, that means we don't want anyone to access our database from the outside of our machine.
it will give you two options :
- Use Strong Password Encryption for Authentication (RECOMMENDED)
- Use Legacy Authentication Method (Retain MySQL 5.x Compatibility)
Since I'm developing and maintaining apps that are built with MySQL 5.x I'm gonna choose the second option and hit Next button.
Account and Roles
That is very important because that password you'll use when you want to connect to your database, I'm gonna a choose a very popular password which is root since I'm only on my local machine, once you choose a password click on the Next button.
Now it suggests to create a service, this service will let you start MySQL if you're using MySQL on your windows all the time once you turn on your machine just let everything by default and click on the Next button, but for me I'm gonna unselect the case Start the MySQL Server at System Startup, I want to start when I want and not with the starting of windows.
Now it's time to apply the changes that we've made just click on the Execute button.
Generally, it will do all those operations
- Write configuration file
- Update Windows Firewall rules
- Adjust Windows service
- Initialize database
- Start the server
- Apply security settings
- Update the Start menu link
If everything is going right you'll end up with something like this:
Congratulation you've just installed MySQL database on Windows successfully now just click on that Finish button.
Check if MySQL Server is installed on Windows.
Now it's time to check if the MySQL Server is really installed on our machine, so just lance you command line or CMD and tap
You can see that it says 'mysql' is not recognized as an internal or external command, operable program or batch file.
To fix this problem we need to go to the installation folder of MySQL which will be on this path: C:\Program Files\MySQL\MySQL Server 8.0, we want to add the bin folder that contains different commands to the environment variables.
Now if you restart your command line and tape again
mysql --version you can see that it output mysql Ver 8.0.22 for Win64 on x8664 (MySQL Community Server - GPL)
If you want to connect and interact with the database you can tape
mysql -uroot -p and tape the password that you set previously in my case it's root and hit enter, you can see that you're connected to the database:
You can run the MySQL commands or MARIA Db commands like
SHOW DATABASES ...
So here we are, the MySQL database is installed correctly on Windows.