How to Connect MySQL Workbench to Localhost (and Fix Errors)

To connect MySQL Workbench to a MySQL server on your own computer, click the + next to MySQL Connections, set Hostname to 127.0.0.1 (or localhost), Port to 3306, and Username to root or your MySQL user, then click Test Connection and enter your password. If it fails, the most common causes are that the MySQL service isn’t running, the password is wrong, or MySQL is using a different port.

Below are the setup steps and fixes for the error messages you’re most likely to see on Windows.

How to set up a localhost connection

  1. Open MySQL Workbench.
  2. Click the + icon next to MySQL Connections.
  3. Enter a Connection Name, like “Local MySQL.”
  4. Keep Connection Method as Standard (TCP/IP).
  5. Set Hostname to 127.0.0.1 and Port to 3306.
  6. Enter your Username, usually root for a fresh install.
  7. Click Test Connection, enter your password, and click OK.
MySQL Workbench Setup New Connection dialog with Hostname 127.0.0.1, Port 3306, Username root, and the Test Connection button highlighted
(1) Use 127.0.0.1 and port 3306, then (2) click Test Connection. (Illustration)

Fix: “Cannot connect to MySQL server on ‘127.0.0.1’ (10061)”

This means nothing is listening on that port, usually because the MySQL service is stopped.

  1. Press Windows + R, type services.msc, and press Enter.
  2. Find MySQL80 (or a similar name, like MySQL84 or MySQL).
  3. Right-click it and choose Start. Set Startup type to Automatic if you want it to start with Windows.

If there’s no MySQL service, the server isn’t installed. MySQL Workbench is only a client. Install MySQL Server with the MySQL Installer. See how to install MySQL on Windows 11.

Fix: “Access denied for user ‘root’@’localhost'”

  • Double-check the password. It’s the one you set during MySQL Server setup.
  • Click Clear next to the password in the connection settings to remove a wrong saved password, then try again.
  • If you’ve forgotten the root password, follow MySQL’s official “reset root password” instructions for your version. It involves stopping the service and starting it with a temporary init file.

Fix: Wrong port or MySQL running elsewhere

  • Check the port in the MySQL configuration file (my.ini, usually in the ProgramData MySQL folder) under port=.
  • Tools like XAMPP or WAMP may run their own MySQL or MariaDB on 3306 or 3307. Make sure you’re connecting to the one you intend, and that two servers aren’t fighting over the same port.
  • Open Command Prompt as admin and run netstat -ano | findstr 3306 to see if something is listening.

Fix: “Authentication plugin ‘caching_sha2_password’ cannot be loaded”

Older Workbench or client versions don’t support MySQL 8’s default authentication. Update MySQL Workbench to the latest version. Changing the user to mysql_native_password is an older workaround and isn’t available in the newest MySQL releases.

Fix: “localhost” works but “127.0.0.1” doesn’t (or vice versa)

On Windows, localhost can resolve to the IPv6 address ::1. If MySQL listens only on IPv4, use 127.0.0.1. Also check the bind-address setting in my.ini.

Related: use SQL Server Management Studio on a Mac.

Related: fix SQL error -803 (SQLSTATE 23505).

Related: Drop a SQL database that is currently in use.

Frequently asked questions

Do I need the internet to connect to localhost?

No. Localhost connections stay on your computer.

Is Windows Firewall blocking my local connection?

Rarely. Local connections to 127.0.0.1 usually aren’t affected. Firewall rules matter when other computers connect to your server.

Where do I download MySQL Workbench?

From MySQL’s official downloads site. See how to install MySQL Workbench on Windows 10.