31st May 2022 6 minutes read How to Install a MySQL Database on a Windows PC Dorota Wdzięczna MySQL installation guide Table of Contents How to Install a MySQL Database on Windows Setting Up Scripting Environments for a MySQL Database Using the MYSQL Workbench Editor Using the MySQL Shell Command Line Do you want to install a MySQL database on your Windows computer? And maybe find out how to start using a MySQL database? In this article, we’ll cover the installation process. MySQL is one of the most popular relational database servers. This is one reason to start using a MySQL database. Among the various editions of MySQL delivered by Oracle, the Community edition is available for free. You can download it from the MySQL website. The latest version of MySQL Community is 8.0; this is the version I’ll use in this article. If you’re not familiar with SQL at all, I recommend checking out a few introductory courses like SQL Basics in MySQL or the SQL Fundamentals in MySQL learning track. You might also be interested in our full MySQL learning path, SQL from A to Z in MySQL. Let’s dig right into installing MySQL – including scripting environments – on a Windows PC. How to Install a MySQL Database on Windows The installation process of the MySQL database is simple. The first step is to download MySQL Community Server. When you load the page, you’ll see something like the screenshot below. From Select Operating System, choose your OS (Microsoft Windows). You can choose ZIP Archive or Installer MSI; I recommend the second option because it is easier to configure the server.To install the installer, click the Go to Download Page button for the MSI installer. You can choose between two kinds of installations: the smaller installer downloads the needed source during the installation process, while the bigger installer contains all the needed files. I recommend the larger installer: Click the Download button. You will be asked for login or signup info, but you can just click the No thanks just start my download link and carry on. The file will start downloading; when it’s ready, run the installer. The installation wizard appears and lets you choose the setup type. Custom allows you to manually select the products you want to install, such as MySQL Shell, connectors, IDE (integrated development environment), etc. The Full setup type installs all available products and features. Sometimes there is a problem with installing one of the products; in that case, you can choose Custom setup type and omit the problem product. The Server Only option installs MySQL server without client applications or connectors; the Client Only installs only client products (like applications and connectors) without the server. Finally, Developer Default lets you install MySQL server on dedicated or development machines. I’m going to choose the custom installation option so I can walk you through the database server and all its client products. The arrows let you select or delete the products to be installed (listed on the right). Once you’ve decided what to install, click the Next button. You’ll see a list of selected features to install. Click the Next button if you don’t need any changes. Another screen confirms the products to be installed. If everything looks good, approve them by clicking the Next button. If you agree with selected packages to install, click Execute. Click the Next button again if everything looks good. In the wizard, you will see information about the configuration process. The next steps configure installed products, so click the Next button to configure the settings. One of the default settings is Port 3306 for the MySQL server. In the Authentication Method, allowing Use of Strong Passwords is recommended. Click the Next button. In Account and Roles, write the password for the admin user in the MySQL server called root. You can also add another user to the MySQL database. To do this, click the Add User button. In the dialog window, enter the user name; you can also change the host or allow the user to connect to all hosts (the default setting). Don’t forget to give the user a password. Accept the settings by clicking the OK button. In the wizard, you will see the new record for the user you just added. Click Next. The next step configures MySQL Server as a Window service; click the Next button to accept this service. In this part of the installation, you will see a list of steps to make certain changes. Apply them by clicking the Execute button. At the end of the configuration, click the Finish button. The next part of the installation starts with the configuration of MySQL products. I’ll leave it with the default settings. Click the Next button and then the Finish button. In Connect to Server, enter the user as root and the password you selected for the root user. Click the Check button to test the connection. If a green checkmark appears, the connection is good; click the Next button. In Apply Configuration, click the Execute button. Wait for the configuration to complete and click the Finish button. Click the Next button again. When the installation process is done, you will see Installation Complete in the wizard. Click the Finish button. The MySQL Workbench editor and MySQL Shell will appear on your screen. Congratulations! You’ve just installed MySQL 8! Setting Up Scripting Environments for a MySQL Database Using the MYSQL Workbench Editor Installing a MySQL database on your PC also gives you the MySQL Workbench editor and command-line tools for writing a SQL script. Note: You can run MySQL Workbench off the Windows Start menu; expand MySQL and select MySQL Workbench 8.0 CE. The screenshot below will show you this editor. If you would like to connect to a server, double click the Local instance MySQL connection. The dialog window appears: Enter the password for root – you can opt to save this information if you like. Click the OK button to apply it. In the Navigator window, you can click on the sample database, expand it, select the Tables node, expand it, and click on the table icon. In the query window, you’ll see some code that will select all the data from this table. You can see this below: Of course, you can create your database and its tables and use them later. Using the MySQL Shell Command Line If you prefer writing scripts using a command-line tool, try MySQL Shell. Open the Start menu, expand the MySQL node, and click on MySQL Shell. This is what you’ll see: By default, it opens in JS mode. You can change it to SQL by writing this command: \sql Next, connect to the MySQL server by writing this command: \connect Then enter the user name, the ‘@’ sign, the host name, and ‘:’. On my computer, I use root (the default admin user) and localhost (the default for your computer) as a host. Press Enter, then submit the password for that user: Now you are ready to write SQL commands to your MySQL database. In my opinion, both MySQL Workbench and MySQL Shell are very good editors for beginners and you don’t need to install them separately. Of course, other options are available; read the article Best SQL IDEs for You in 2021 for more ideas. MySQL is not the only great database. You can also learn how to install PostgreSQL on Windows 10 in 5 minutes and How to Install Microsoft SQL Server 2019 and SQL Server Management Studio elsewhere on our blog. And remember, if you want to learn how to write queries in MySQL, check out our interactive online courses. Have fun with your MySQL database, MySQL Workbench IDE, and MySQL Shell! Tags: MySQL installation guide