Setup: Install MySQL Server and Workbench

Install MySQL 8.4, set it up with MySQL Configurator and a root password, and connect to it from MySQL Workbench.

Novice · Operating System · MySQL · Updated

By

After this lesson you can

  • Install and configure a local MySQL server
  • Connect to a database server from MySQL Workbench

Windows only. A database server stores data and answers questions about it. In this bootcamp you will use MySQL, version 8.4, a long-term support release. MySQL Workbench is the app you will use to look at your databases and run SQL.

Install MySQL Server

In Git Bash, run:

winget install -e --id Oracle.MySQL --interactive

winget may first install a small Microsoft component that MySQL needs (the Visual C++ Redistributable). Then the MySQL installer opens.

  1. Click Next, accept the license, and click Next.
  2. Choose Typical, then click Install. Click Yes if Windows asks whether the app may make changes.
  3. On the last page, leave Run MySQL Configurator checked and click Finish.

Configure MySQL

MySQL Configurator opens. The server will not run until you finish it.

  1. Welcome and Data Directory: click Next.
  2. Type and Networking: set Config Type to Development Computer. Leave the port as 3306. Click Next.
  3. Accounts and Roles: type a MySQL Root Password and type it again in Repeat Password. Click Next.
  4. Windows Service: leave Configure MySQL Server as a Windows Service and Start the MySQL Server at System Startup checked. Click Next.
  5. Server File Permissions: click Next.
  6. Sample Databases: leave them unchecked. You will create the course's databases later. Click Next.
  7. Apply Configuration: click Execute. Each step gets a green check. Click Next, then Finish.

MySQL's main user is called root. This database only runs on your own computer, for practice. Choose a root password you can remember and write it down. Do not reuse a password from your email or bank.

Install MySQL Workbench

winget install -e --id Oracle.MySQLWorkbench

Click Yes if Windows asks whether the app may make changes.

Check your work

Open MySQL Workbench from the Start menu. Under MySQL Connections, you should see a tile for your local server, such as Local instance MySQL84.

If there is no tile, click the + beside MySQL Connections. Set Connection Name to Local, Hostname to 127.0.0.1, Port to 3306, and Username to root, then click OK.

Click the tile and enter your root password. A query tab opens. Type this:

SELECT VERSION();

Click the lightning bolt button above it to run it. You should see a version that starts with 8.4 in the results below.

Common problems

What you see What to do
MySQL Configurator did not open Click Start, type MySQL Configurator, and open it.
Cannot Connect to Database Server in Workbench The server is not running. Click Start, type Services, open it, find MySQL84, and click Start.
Access denied for user 'root'@'localhost' The password is wrong. Type it carefully, and check that Caps Lock is off.
You forgot the root password Follow MySQL's own steps in How to Reset the Root Password (the Windows section). Then write the new password down.