How to install MySQL on Windows 10/11 & Windows Server

How to Setup a LAMP Stack on Windows for Web Development

Introduction

MySQL is an open-source relational database management system (RDBMS). It stores, manages, and retrieves data using Structured Query Language (SQL). Here, the data is stored in rows and columns in tables, and applications connect to a database server for data operations, and it supports complex queries and transactions.

Let’s dive in to understand how to setup MySQL and create a database in MySQL:

Step-by-Step Guide

1. Go to https://dev.mysql.com/downloads/installer and click on Download next to Windows (x86, 32-bit), MSI Installer (mysql-installer-community-8.0.39.0.msi)—this works for 64-bit also.

Download MySQL Installer MSI for Windows 10 /11 & Windows Server

2. A new window opens; click on No thanks; just start my download to start downloading MySQL.

Start MySQL Installer Download for Windows

3. On the right-hand corner, click on Open File under Downloads.

Open file – MySQL Installer File from Downloads

or click on a folder icon and double-click on mysql-installer-community-8.0.39.0 to start the installation.

Double-click on mysql-installer-community-8.0.39.0

4. The MySQL Installer set-up wizard opens.

  • In the Choosing Setup Type window, select Custom and click Next.

Note: By selecting the custom option, we can manually select the products that should be installed on the computer.

Choose Custom to manually select MySQL product for your Windows OS

5. In the Select Products window,

Under Available products,

  • Click on the + icon next to MySQL Servers; under that, select MySQL Server 8.0.39-x64 and click on the green arrow button.
Select MySQL Server
  • Click on the + icon next to Applications, select MySQL Workbench 8.0.38-x64, and then click on the green arrow button
Select MySQL Workbench
  • Click on the + icon next to MySQL Shell, select MySQL Shell 8.0.38-x64, and then click on the green arrow button.
  • After adding the selected products, click on Next.
Select MySQL Shell

6. In the installation window, you can see the products that are to be installed.

  • Click on Execute.
Execute SQL statements
  • Once the installation is complete, you can see the screen below. Click on Next.
MySQL Installation Completion Status Confirmation.

7. In the Product Configuration window, click on Next.

Proceed with MySQL Product Configuration Setup

8. In the Type and Networking window, you can see Server Configuration Type, Connectivity, and Advanced Configuration.

  • Click on Next
Configure Type and Networking Settings for MySQL Server

9. In the Authentication Method window, select Use Strong Password Encryption for Authentication (Recommended).

  • Click on Next.
Select Strong Password Encryption for MySQL Authentication

10. In the Accounts and Roles window, enter the strong password in MySQL Root Password and Repeat Password.

  • Click on Next.
Enter and Confirm MySQL Root Password during the Setup

11.  In Windows Service,

  • Check the box next to Configure MySQL Server as a Windows Service.
  • Check the box next to Start MySQL Server at System Startup.
  • Select the Standard System Account.
  • Click on Next.
Configure MySQL Server as Windows Service

12. In the Server File Permissions window,

  • Select Yes, and grant full access to the user running the Windows Service (if applicable) and the administrator group only. Other users and groups will not have access.
  • Click Next.
Grant File Permissions for MySQL Server on Windows

13.  In the Apply Configuration windows, click Execute.

Execute and Apply MySQL Server Configuration Settings
  • Once the configuration is successful, click on Finish.
MySQL Configuration is successful

14.  In the Product Configuration window, click Next.

Complete MySQL Product Configuration Process

15.  In the Installation Complete window,

  • Check the box next to Start MySQL Workbench after setup.
  • Check the box next to Start MySQL Shell after setup.
  • Click Finish.
Finish MySQL Installation and start MySQL Workbench and MySQL Shell

16.  Once we click on Finish, it will navigate to the command prompt showing the installation of MySQL Shell 8.0.38.

MySQL Shell is open in the Command Prompt

After a few seconds, it will navigate to MySQL Workbench. Here, click on Local instance MySQL8.0

Access MySQL Workbench after installation

17.  Here,

  • Enter the Password that you already mentioned in step 10 (Accounts and Roles window)
  • Check the box next to Save Password in the vault.
  • Click on OK.
Login to Local MySQL Instance in Workbench

18.  Now, you are in MySQL Workbench.

Create New Schema in MySQL Workbench
  • Here, you create a new schema by clicking on the Create new schema icon. Enter the name and click on Apply.

Note: Here, the name of the schema is employee.

  • A new window opens showing the schema that was created, and you can click on Apply.
Apply to CREATE SCHEMA
  • Click on Finish.
Execute SQL statements
  • Now, in the workbench, create tables in the schema.

Click on Schemas in the bottom left corner of the window. It will show you the schemas that were created.

sys is the default schema.

Click on the drop-down menu next to your schema_name (ex: employee), and you can see tables, views, stored procedures, and functions. You can select any of them according to your requirements and fill in the information.

Note: You can also create tables using the table icon in the menu bar.

Create a new table in MySQL Workbench

19. We must add the path to MySQL in Environment Variables. To do so,

  • Go to the Windows search bar and type environment variables.
  • Select Edit the system environment variables
Search for environment variable in Windows search bar
  • In the System Properties window, click on Environment Variables.
Add MySQL Path to Windows Environment Variables
  • The Environment Variables window opens.
  • Under System Variables, double-click on Path (which is highlighted) and click OK.
Select Path under System variables
  • Click on New, add the new path, and click on OK.
Add MySQL Server Path
  • After this, click OK in the Environment Variables window and
  • Click OK under the System Properties window.

20. Open the command prompt by typing cmd in the Windows search bar.

Here, verify the installation of MySQL by running the below command.

Command: mysql --version

If it is successfully installed, you can see the message “MySQL Ver 8.0.39 for Win64 on x86_64 (MySQL Community Server, GPL).”

Check MySQL Version in Windows Command Prompt

21. By running the below command, you can log in to MySQL Server.

Command: mysql -u root -p

After running this command, you will be prompted to enter a password (which is given in step 10: Accounts and Roles window).

You can also see your MySQL connection ID (here it is 15).

Login to MySQL Server using Command Line Interface

22.  You can see if there are any databases by default by running the below command.

Command: show databases;

Note: You can see there are no databases at present.

Display default databases in MySQL Server

23.  You can create a database by running the command below.

Command: create database d; 
create database d1;
  • Now, run the below command to verify if the databases are added or not.
Command: show databases;

Now, you can see that ‘d’ and ‘d1’ databases have been added.

Create new databases and verify in MySQL Server

Frequently Asked Questions (FAQs)

Q1. What is MySQL used for?

Answer: MySQL is a popular relational database management system (RDBMS) used for managing and organizing data. It is commonly used in web applications, data warehousing, and business applications to store, retrieve, and manipulate data.

Q2. What is SQL vs. MySQL?

Answer: SQL (Structured Query Language) is a standard language used for querying and managing databases. It provides commands to perform various operations on data, such as querying, updating, and deleting records. MySQL, on the other hand, is a specific relational database management system that uses SQL as its query language. Essentially, SQL is the language you use, and MySQL is the software that processes SQL commands.

Q3. Is MySQL a coding language?

Answer: No, MySQL is not a coding language. It is a database management system that uses SQL, a query language, to interact with databases. MySQL provides a platform where SQL commands are executed to manage and manipulate data.

Q4. What is MySQL’s role?

Answer: MySQL’s role is to store, manage, and retrieve data efficiently. It provides a structured way to store data in tables, supports complex queries to access the data, and ensures data integrity and security. It is widely used in various applications, from small websites to large enterprise systems.

Q5. Is MySQL easy to learn?

Answer: MySQL is generally considered to be beginner-friendly, especially if you are familiar with SQL. The basic concepts and commands are relatively straightforward to learn, but mastering advanced features and optimizations may take more time and experience.

Q6. Which software is used for MySQL?

Answer: To interact with MySQL databases, you can use various software tools, such as:

  • MySQL Workbench: A graphical user interface (GUI) for designing, managing, and administering MySQL databases.
  • phpMyAdmin: A web-based tool for managing MySQL databases.
  • MySQL Command Line Client: A command-line interface for executing SQL commands.
  • DBeaver: A universal database tool that supports MySQL and other database systems.

Ready to streamline your technical writing needs? At The Scribe, we offer a range of expertly curated writing services to enhance your documentation and content. Whether you need technical manuals, website content, or comprehensive business proposals, our skilled writers are here to help. Contact us today to see how we can support your web development projects with clear, impactful documentation!

Komal

Komal

Table of Contents

Read More

Scroll to Top