Home / Localhost / localhost:3306

localhost:3306: MySQL and MariaDB connection fixes

Port 3306 is the default MySQL and MariaDB port. It is not a web page: connect with a client and fix refused connections.

A database client connects to localhost:3306, which is port 3306 on your computer, where MySQL, MariaDB is running

Not a web pagePort 3306 belongs to a database. Connect with a client such as the mysql command, not a browser.

localhost:3306 is where MySQL or MariaDB listens by default. Opening it in a browser shows nothing useful, so use a database client or the mysql command instead.

What runs on localhost:3306

Commands to start and test port 3306

Connect with the command line
mysql -h 127.0.0.1 -P 3306 -u root -p
Is the service running? (Linux)
sudo systemctl status mysql
Start it (Linux)
sudo systemctl start mysql
Docker: run a test database
docker run -p 3306:3306 -e MYSQL_ROOT_PASSWORD=change-me mysql:8

Find what is using port 3306

Run these in a terminal on your computer. Nothing is sent to this site.

If localhost:3306 will not open

ERROR 2002: Can’t connect through socket
The server is not running, or the client is using a socket file instead of TCP. Start MySQL and connect with -h 127.0.0.1 to force a TCP connection.
Access denied for user
The username or password is wrong. See MySQL access denied for root.
Port 3306 is already in use
Another MySQL service is running, for example MySQL80 on Windows. Stop it, or change the port. Use the port checker below.
Host is not allowed to connect
The user exists only for localhost. Create a user for the host you connect from.

Other ports like 3306

PortUsually used by
localhost:5432PostgreSQL
localhost:27017MongoDB
localhost:6379Redis
localhost:11211Memcached
localhost:1433Microsoft SQL Server
localhost:5984CouchDB
localhost:8983Apache Solr

Questions about localhost:3306

What runs on port 3306?
MySQL and MariaDB database servers.
How do I check if MySQL is running on 3306?
Run the port checker command below. If a program listens on 3306, the server is up.
Is localhost:3306 safe?
Yes while it listens only on 127.0.0.1. If you open this port to a network, use a strong password, allow only trusted addresses in the firewall, and encrypt the connection. Do not expose a database port to the internet.
Can I use a different port instead of 3306?
Yes. Pick a free port above 1024, set it in the program, and open that number instead. If other programs connect to this port, change it there as well.
How do I check what is using port 3306?
Use the port checker on this page. It shows the command for Windows, macOS and Linux and does not send anything to this site.

Updated 2026-10-03

Free tools that help

Related pages