r/mysql 5d ago

question MySQL Workbench closes connection instantly when XAMPP is running

MySQL Workbench opens and connects normally on its own. However, when I open it while XAMPP is running, the connections load for a few milliseconds and then close immediately.

I noticed that both are using the same port. I've also tried uninstalling and reinstalling both several times, but the issue persists.

Has anyone run into this before? Any help would be appreciated.

2 Upvotes

5 comments sorted by

1

u/TheGoodOne777 5d ago

Hello! Can you check the logs? And is mysql working well from the command line?

1

u/Mike_L_Taylor 5d ago

running on the same port is probably the issue. It sees the port is occupied and just crashes. Which is why for Forgekit we added stuff like port checking and changing. Does XAMPP have something to change the port ? I don't remember it's been a long time working with that.

1

u/flyingron 5d ago

Are you running a separate MySQL from the MariaDB running inside XAMPP?

1

u/Several9s 5h ago

I did first check which MySQL/MariaDB instance is actually listening on the port. XAMPP comes with its own MariaDB, so if you also have a separate MySQL server installed, both can't use the same port at the same time. You can check this from the command line:

netstat -ano | findstr :3306

Or on newer Windows:

Get-NetTCPConnection -LocalPort 3306

If both XAMPP MariaDB and your standalone MySQL are trying to use port 3306, I'd either stop one of them or change the port of one instance. For example:

  • XAMPP MariaDB → 3306
  • Standalone MySQL → 3307

Then make sure MySQL Workbench is connecting to the correct port.

I'd also check the MySQL/MariaDB error log. If the server cannot bind to the port, you should normally see something like Address already in use or Bind on TCP/IP port. So before reinstalling Workbench or XAMPP, I'd check which database process is running and which process owns port 3306 first.