How to install MySQL on windows 10

In this step by step guide, we are answering the question of how to install MySQL on Windows, specifically Windows 10. We are starting with downloading MySQL installer until we are able to run a basic query on the database.

Here is the guide PDF file for download: How to install MySQL on windows 10 (web) (1629 downloads )

Disclaimer:

  • MySQL is a trademark of Oracle.
  • The images from the installation are copyright © by Oracle.
  • Turn on windows feature screen is copyright © by Microsoft.
  • Windows 10 is copyright © by Microsoft.

Step 1 – downloading MySQL:

The first step is to download MySQL from the internet. Open your web browser and navigate to the following URL: Download MySQL

MySQL Community Download
MySQL Community Download

Once you press the download button. You will be redirected to the following URL: https://dev.mysql.com/downloads/file/?id=497106

Please note, the ID might be different.

MySQL Community Downloads
MySQL Community Downloads

 

If you have an account you can log in by pressing the login button. If you want you can create an account by pressing the Sign-Up button and fill the needed information.

Below it there is a link for the download. You can use this direct link to start download the MySQL installer.

Right-click on this link show the direct download URL, here is what I get:

https://dev.mysql.com/get/Downloads/MySQLInstaller/mysql-installer-community-8.0.21.0.msi

Please note that it may not work once the version will be change – in my case it downloads version 8.0.21.0.

Once the download is done, you can go to the folder that the file was saved and run it. The default download folder should be Downloads. That is unless you change your download folder or select a different download location.

Step2 – Installing MySQL on Windows 10:

To start the installation, right-click the file and select install. You will see the following screen at the start of the installation.

MySQL Installer - Community
MySQL Installer – Community

If you see the User Access Control screen please allow it by pressing yes. If everything went well you will see the following screen:

MySQL - Choosing a setup type
MySQL – Choosing a setup type

In this guide, we are selecting the full option. This will install everything, here is the text from the description box:

Installs all of the products available in this catalog including MySQL Server, MySQL Shell, MySQL Router, MySQL Workbench, MySQL Connectors, documentation, samples, and examples, and much more.

You might have to install some requirements, that MySQL needs before the installation.

In my case, the only one that is missing is the Microsoft Visual C++ 2019 Redistributable Package. MySQL installation can install it automatically.

You may need to install another component that MySQL requires. If the requirement is not part of the installation you will have to install it, by downloading it from the internet or by using the Turn Windows Features on or off.

Turn Windows features on or off
Turn Windows features on or off

To continue our installation, I selected the first one and press the Execute button.

MySQL Check Requirements
MySQL Check Requirements

The inhalation will start to download the pre-requirement and install them. You can see the status changes.

MySQL downloading requirement
MySQL downloading requirement

Once it done, the screen will change and you can press the next button to continue:

MySQL downloading requirement finished
MySQL downloading requirement finished

Once pressing the next button the install screen appears and you can press the Execute to start the installation:

MySQL installation continue
MySQL installation continue

Let the installation process run, it may take some time…

MySQL the following products will be installed
MySQL the following products will be installed

Once everything is complete you can press the Next button to continue.

MySQL Installation done
MySQL Installation is done.

 

Step3 – Configuration:

Once you press the next button on the above step you will get a screen that is related to configuration.

MySQL Product Configuration
MySQL Product Configuration

We are not configuring a cluster in this guide, maybe in the future, I will create a guide to configure a cluster with MySQL.  Make sure you selected the Standalone MySQL server and press Next.

MySQL Standalone server
MySQL Standalone server

If you need to change the default port it will use, you can do it here. Also, for this guide, I am using the Development Computer option as this is my dev device and I will use it to debug the site, apps, and query that I will develop. You can select the Server option if you don’t need a development environment.

I did mark the Show advanced and Logging option for some more configuration options.

MySQL Show Advanced and Logging Options
MySQL Show Advanced and Logging Options

For the authentication method, I am using the strong password option that is recommended by the installation.

MySQL Authentication Method
MySQL Authentication Method

Set a strong password, and if you need to add more users to MySQL you can do it using the Add User button.

MySQL Set Strong Password
MySQL Set Strong Password

MySQL is configured to run as a service. It is adding another service to your running service. Adding it as a service will let MySQL run even if no user is currently logon in the system.

MySQL Windows Service
MySQL Windows Service

You can leave the log names as-is unless you want to give it another name.

MySQL Logging Options
MySQL Logging Options

And also the Advanced options.

MySQL Advanced Options Settings
MySQL Advanced Options Settings

The next step is to apply the configuration that we did:

MySQL Apply Configuration
MySQL Apply Configuration

Once this process is done your MySQL server is installed and running. Press Finish to finish the installation and move on to the configuration part.

MySQL Apply Configuration Finish
MySQL Apply Configuration Finish

 

Step 4 – MySQL product configuration continues:

MySQL product configuration continue
MySQL product configuration continue

As we are not configuring a cluster, we can skip the router configuration. Just press the Finish button.

MySQL Router Configuration
MySQL Router Configuration

Next step is the connection to your server, here we can verify that we can connect to our MySQL server

Use the password we configure during the installation.

MySQL Connect to server
MySQL Connect to server

If everything is ok, we can continue by pressing Next. In the next screen press the Execute button to apply the configuration.

MySQL Apply Configuration
MySQL Apply Configuration

You will see small green V marks. That indicates the installation was successful.

Press the Finish button to go to the next step.

MySQL Apply Configuration Continue
MySQL Apply Configuration Continue

The next step is related to the installation of the sample and examples. Press the next button wait for it to finish.

MySQL Product Configuration Continue
MySQL Product Configuration Continue

Once it finishes you will see the following screen. Live both of the option marks and finish the installation by pressing the finish button.

MySQL Product Configuration Complete
MySQL Product Configuration Complete

Step 5 – We have a database lets have fun:

Once you press the Finish button and if you select both option 2 windows will be open.

One for a command-line interface to the database:

MySQL Command Line Interface
MySQL Command Line Interface

And another one, a GUI based interface:

MySQL GUI Interface
MySQL GUI Interface

BTW, the following was added to your Menu:

MySQL Added Menu
MySQL Added Menu

And here is our MySQL service, running:

MySQL Service Info
MySQL Service Info

Step 6 – MySQL the command line:

When using the command line interface one of the first commands you need to know is \help using that command will show you help about other commands.

MySQL command line shell
MySQL command-line shell

Connecting to the database:

To connect the database, you can use the MySQL command. Type MySQL and press enter.

Next, you need to connect to the database, run the following command:

\connect –mx root@localhost

It will prompt you for the password, insert the password and press enter. Use the password we enter during the installation process of MySQL.

Create new database

To create a new database, we need to run the following command:

\show query create database openport

The above command tells MySQL to create a new database name openport. After running that command you will have a new ready to use, an empty, database named openport.

Once the database is ready, we need to tell MySQL that we want to use this database. Run the following command:

\show query use openport

Now we are using the openport database.

Adding table to the database

To add a table to the database, you need first to think about what you want to store in that table and to design it. For the use of our guide, we will create a table to store basic information about URL.

The table will contain the following URL information:

  • Link – A link in the site, re: https://openport.net
  • Added – The date we added this link.
  • Modify – The date that link changed, or removed.
  • Status – Current status of the link, can be 1-active, 2-disable, 3-deleted.

Let’s run the command to create our table:

\show query create table url (link VARCHAR(100), added DATE, modify DATE, status int)

  • VARCHAR – mean this will hold a string value.
  • DATE – mean this will hold a date.
  • INT – Mean this will hold a number.

Cool, we have a table that we can now start to add some date.

Adding some data to the table

I am using the following command to add one line of data to our table.

\show query insert into url (link, added,modify,status) values (‘https://openport.net’, NOW(),NOW(),1)

Once running this command, a new line will be created and added to the database with the following information, the link, the dates, and 1 as the active status.

Show the table data:

OK, now that we added the data into our table let see it. Use the following command to see the data we have in our table:

\show query select * from url

After running this command, you will see an output text table with one line in it. The line we insert into the database.

Here is an image that shows the above steps:

MySQL Running the command
MySQL Running the command

Some more useful commands:

This command will show you the list of databases that you have:

\show query show databases

The following command will show you all the tables you have in the currently selected database:

\show query show tables 

This command will show you information about the table name url:

\show query describe url

MySQL The describe query output
MySQL The describe query output

Step 7 – MySQL the GUI way:

Press on the MySQL Connection area, a Connect to MySQL dialog will be open, type in your password and press OK.

MySQL GUI DB Login
MySQL GUI DB Login

The following windows will be open:

MySQL GUI Database info
MySQL GUI Database info

Now that we are connected to the database lets do what we do in the command line but from the GUI.

Create a new database:

Press the add new schema icon, then give our database a name. After that press the apply button.

MySQL Adding new schema
MySQL Adding new schema

A new window will be open, that will show you the query it is about to run to create that database.

Press apply to continue.

MySQL Running the add schema query
MySQL Running the add schema query

And then press finish to close the database creation wizard.

MySQL Finish adding the schema
MySQL Finish adding the schema

Now we have a new database.

MySQL we have a new DB
MySQL we have a new DB

Create a new table:

Let’s add a new table to the database, we will use the same information as we did for the table in the command line section.

Expend the openport database that we created.

Right-click on tables and select Create table.

Set the table name. Press the Column name to start adding a new column to our table.

The first column is a running index, we did not add it in the command line version.

The PK, NN, UQ, AI are optional options, and you can set a default value to the columns.

In our case, the first index (idurl) is a primary key (PK), not null (empty) (NN), unique (UQ), and with a default value of 1001. This means that will Autoincrement (AI) with each newly added URL to the table.

I also set our status with a default value of 1.

Press Apply.

MySQL Create new table
MySQL Create new table

An SQL query script window will appear, it will show you the query it is about to run to create our table. Press Apply to continue. Now we have our table ready.

MySQL here is our table
MySQL here is our table

Add data to that table:

Let’s add data to our table. One of the options to add data to our table is by expending our table, and right-click on columns->Send to SQL Editor->Insert Statement.

Insert, in SQL, is the command to add (insert) data to the table.

MySQL Insert data to our table
MySQL Insert data to our table

This method allows us to run a query to add data, you will need to type it into the query.

MySQL the insert query
MySQL the insert query

Another method is using the UI. You can do it by double click on the following table like icon near our table name:

MySQL table icon
MySQL table icon

This will open a window that contains a grid that you can use to add new data to the table.

Fill in the needed information and press Apply.

MySQL We data in the table
MySQL See data in the table

And we have new data in our table.

TIP:

Our table requires a date parameter, this should be the current date.

To get the current date, you can run a query – SELECT NOW()

Type it in the above text area, after the SELECT. Select it with your mouse (mark). Press the lightning icon for running only the selected query.

MySQL Mark and Run the Query
MySQL Mark and Run the Query

Show table information:

Now we need to see the new data that we insert into our table to do that we can run the query we have in the text box. We can also reopen it by pressing the table button and it will show it to us:

MySQL show my the data
MySQL show me the data

Cool, we have data in our table.

The end?

Well, in this guide we download MySQL from the internet, run through the installation process, configure it to run. Created a new database, add data to the database, and see it. This is the end of this guide, but it is definitely not the end of your learning, you can now go deeper into MySQL databases, by learning to write queries, learning how to manage the database, backup, procedure and more.

I do hope that this guide gives you the information you needed, regarding how to install MySQL on Windows 10.

If you have any questions or comments, you are more than welcome to contact us using our contact page.

 

References:

2 thoughts on “How to install MySQL on windows 10”

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.