Menu
User

DropVPS Team

Writer: John hens

How to change MySQL Port in Laragon?

How to change MySQL Port in Laragon?

Publication Date

12/25/2025

Category

Articles

Reading Time

2 Min

Table of Contents

Laragon is a powerful local development environment for Windows that includes MySQL by default. Normally, MySQL runs on port 3306, but sometimes you need to change this port due to conflicts with other services or custom development requirements.

 

STEP 1: Stop MySQL in Laragon

Before editing any configuration files, MySQL must be stopped to prevent errors or file locks.This ensures the configuration changes are applied correctly.

Open Laragon  
Menu → Stop All  
(or stop MySQL only)

STEP 2: Open the MySQL Configuration File (my.ini)

Laragon stores MySQL settings inside the my.ini file.Open this file using Notepad or Notepad++ with administrator privileges.

C:\laragon\bin\mysql\mysql-<version>\my.ini

STEP 3: Change the MySQL Port

Inside the my.ini file, find the [mysqld] section and locate the port setting.Save the file after editing.

[mysqld]
port=3306

Change it to a new free port, for example:

[mysqld]
port=3307

STEP 4: Update MySQL Port in Laragon Settings

Laragon must also be updated so it knows which port MySQL is using.Change the MySQL port to match your new value (for example 3307) and click Save.

Laragon Menu → Preferences → Services & Ports

STEP 5: Restart MySQL Service

Now restart MySQL so the new port takes effect.If MySQL starts without errors, the port change was successful

Laragon Menu → Start All  
(or Start MySQL)

STEP 6: Verify the New MySQL Port

You can verify that MySQL is running on the new port using the command lineIf MySQL connects successfully, the new port is active.

mysql -u root -p -P 3307 -h 127.0.0.1

STEP 7: Update Applications Using MySQL

Any application that connects to MySQL must be updated to use the new port.
For example, in a Laravel .env file:Restart your application after updating the configuration.

DB_HOST=127.0.0.1
DB_PORT=3307
DB_DATABASE=example_db
DB_USERNAME=root
DB_PASSWORD=

STEP 8: Fix Common Problems

After changing the MySQL port in Laragon, you may face a few common issues related to port conflicts, connection errors, or misconfigured clients.

netstat -ano | findstr :3307
Windows VPS
U
Loading...

Related Posts