r/mysql • u/KARMERIN • Sep 03 '26
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
1
u/TheGoodOne777 Sep 03 '26
Hello! Can you check the logs? And is mysql working well from the command line?
1
u/Mike_L_Taylor Sep 03 '26
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 Sep 03 '26
Are you running a separate MySQL from the MariaDB running inside XAMPP?
1
u/Several9s Sep 08 '26
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 :3306Or on newer Windows:
Get-NetTCPConnection -LocalPort 3306If 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:
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 useorBind 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.1
u/navicat-gu Oct 20 '26
Reinstalling won't fix this because nothing is broken. It's two database servers fighting over one port. XAMPP's "MySQL" module is MariaDB, and whichever server starts first takes 3306. When XAMPP wins, Workbench's saved connection lands on MariaDB instead of your MySQL, and the session fails or drops, especially on the newer Workbench, which officially targets MySQL 8.4+ rather than MariaDB.
Confirm it:
C:\xampp\mysql\bin\mysqld.exemeans XAMPP has the port.Fix by giving each server its own port:
C:\xampp\mysql\bin\my.ini: setport=3307under[client]and[mysqld].C:\xampp\phpMyAdmin\config.inc.phpadd$cfg['Servers'][$i]['port'] = '3307';Alternative: if you don't need MariaDB at all, just don't start XAMPP's MySQL module and point your PHP apps at your MySQL server on 3306.
If it still closes after that, check
%APPDATA%\MySQL\Workbench\log\wb.logfor the actual error.Disclosure: I'm RC, Director of Digital Strategy @ Navicat. Navicat Premium Lite is free and handles MySQL and MariaDB connections side by side (e.g. 3306 and 3307) in one window, if that setup is useful to you.