SQL Port error solve

 

Step 1: Check MySQL port

  1. Open XAMPP Control Panel as Administrator.

  2. Click Netstat.

  3. Check whether port 3306 is already being used.

You can also check using CMD:

netstat -ano | findstr :3306

If you see something like:

TCP    0.0.0.0:3306    0.0.0.0:0    LISTENING    1234

Another process is using port 3306.

To identify it:

tasklist | findstr 1234

Replace 1234 with your actual PID.

Step 2: Check Windows MySQL service

  1. Press Win + R.

  2. Type services.msc.

  3. Press Enter.

  4. Find these services if present:

    • MySQL

    • MySQL80

    • MariaDB

If another MySQL service is running, stop it temporarily and try starting MySQL in XAMPP.

Step 3: Check MySQL error log

In XAMPP:

  1. Click MySQL → Logs.

  2. Open mysql_error.log.

  3. Go to the bottom.

  4. Copy the last 20–30 lines.

This log will help identify the actual problem.

Step 4: If database files are corrupted

Don't replace or delete the data folder yet. First make a complete backup of:

C:\xampp\mysql\data

We can recover your databases without losing your existing projects.

Post a Comment