1

I've got a XAMPP installation (Apache, MySQL, php, phpmyadmin) on a Windows 10 machine, in D:\xampp, which I've been using for at least 3 months without any issues.

Since today, without having changed any config or installed anything, when trying to start MySQL I get this error in XAMPP console window:

20:17:05  [mysql]   Status change detected: running
20:17:08  [mysql]   Status change detected: stopped
20:17:08  [mysql]   Error: MySQL shutdown unexpectedly.
20:17:08  [mysql]   This may be due to a blocked port, missing dependencies, 
20:17:08  [mysql]   improper privileges, a crash, or a shutdown by another method.
20:17:08  [mysql]   Press the Logs button to view error logs and check
20:17:08  [mysql]   the Windows Event Viewer for more clues
20:17:08  [mysql]   If you need more help, copy and post this
20:17:08  [mysql]   entire log window on the forums

And this in mysql_error.log:

InnoDB: using atomic writes.
2019-11-19 20:17:05 0 [Note] InnoDB: Mutexes and rw_locks use Windows interlocked functions
2019-11-19 20:17:05 0 [Note] InnoDB: Uses event mutexes
2019-11-19 20:17:05 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
2019-11-19 20:17:05 0 [Note] InnoDB: Number of pools: 1
2019-11-19 20:17:05 0 [Note] InnoDB: Using SSE2 crc32 instructions
2019-11-19 20:17:05 0 [Note] InnoDB: Initializing buffer pool, total size = 16M, instances = 1, chunk size = 16M
2019-11-19 20:17:05 0 [Note] InnoDB: Completed initialization of buffer pool
2019-11-19 20:17:06 0 [Note] InnoDB: 128 out of 128 rollback segments are active.
2019-11-19 20:17:06 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2019-11-19 20:17:06 0 [Note] InnoDB: Setting file 'D:\xampp\mysql\data\ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2019-11-19 20:17:06 0 [Note] InnoDB: File 'D:\xampp\mysql\data\ibtmp1' size is now 12 MB.
2019-11-19 20:17:06 0 [Note] InnoDB: Waiting for purge to start
2019-11-19 20:17:06 0 [Note] InnoDB: 10.4.8 started; log sequence number 300333; transaction id 171
2019-11-19 20:17:06 0 [Note] InnoDB: Loading buffer pool(s) from D:\xampp\mysql\data\ib_buffer_pool
2019-11-19 20:17:06 0 [Note] Plugin 'FEEDBACK' is disabled.
2019-11-19 20:17:06 0 [Note] Server socket created on IP: '::'.
2019-11-19 20:17:06 0 [ERROR] Can't start server: Bind on TCP/IP port. Got error: 10013: An attempt was made to access a socket in a way forbidden by its access permissions.


2019-11-19 20:17:06 0 [ERROR] Do you already have another mysqld server running on port: 3306 ?
2019-11-19 20:17:06 0 [ERROR] Aborting

However it looks like nothing is running in port 3306:

  • No other MySQL process or service running
  • Port 3306 doesn't show up when running netstat
  • Not blocked in Windows firewall

If I change the port to something random (eg 10200) MySQL starts and works normally. Port 3307 and 3308 don't work even though it looks like they aren't in use either, exactly like 3306.

Things I've tried and didn't solve the issue:

  • (obviously) Restart XAMPP & PC
  • Clear D:\xampp\mysql\data directory
  • Clean installation of XAMPP
  • Run as admin
  • Start MySQL from the Window's console
  • Reset firewall rules
  • Turn off firewall/antivirus

As I mentioned before, running MySQL on some different port, like 10200, worked. So besides being able to run MySQL on 3306 again, I am also interested in finding out what exactly is going on and how it happened. Any ideas appreciated!

Edit: There was a Windows update (KB4522741), but I do not think it's somehow related.

  • Try with `netstat -an | findstr 3306` to see if something else is bound to that port. – lainatnavi Nov 19 '19 at 18:57
  • @lainatnavi have tried already and just reconfirmed. Returns empty so I suppose the port should be available – Chris Foteinos Nov 19 '19 at 19:29
  • 1
    Check this KBA https://support.microsoft.com/en-ca/help/4093046/ports-blocked-after-you-install-monthly-rollup-package-kb4074588 and see if this is the case. Also run `netsh int ipv6 show dynamicport tcp` to see the range of reserved ports. Anyways running the service as administrator should be able to bind any port. – lainatnavi Nov 19 '19 at 19:43
  • This might help too: https://github.com/docker/for-win/issues/1707 – lainatnavi Nov 19 '19 at 19:57
  • 2
    Looks like the problem is solved. Following the direction you pointed me towards, I checked the ports with `netsh interface ipv4 show excludedportrange protocol=tcp` and indeed 3306 was reserved. Then I uninstalled KB4522741, problem solved! Re-installed it to make sure it is responsible but now 3306 is **not** reserved, everything works well. I don't understand this, I wouldn't imagine Windows reserved ports, let alone common ones such as 3306... Thank you so much @lainatnavi for the help. – Chris Foteinos Nov 19 '19 at 23:52
  • For me it was also related to excluded ports and Hyper-V. See this answer: [An attempt was made to access a socket in a way forbidden by its access permissions](https://stackoverflow.com/a/59165435/247893) – h2ooooooo Oct 19 '20 at 17:33
  • This is a long standing issue with winnat causing some kind of access denied on new port binds. Sometimes it helps to disable all network devices in Device Manager. Sometimes you need to reboot. – Henk Poley Mar 11 '22 at 09:30
  • This should exclude winnat from handing out port 3066 `netsh int ipv4 add excludedportrange protocol=tcp startport=3066 numberofports=1` – Henk Poley Mar 11 '22 at 09:35

2 Answers2

1

You might be facing this issue because there are other services being handled on port 3306. This could also be due to MySQL (other than the one which comes with xampp setup) installed in your system.

My solution: Just head to the folder of bin in MySQL server on your machine and run this command from that directory in your command prompt.(for example: C:\Program Files\MySQL\MySQL Server 8.0\bin) mysqladmin -u root -p shutdown

This command will safely shut down your existing MySQL running on port 3306 so that you can access the same port using the MySQL on xampp. This is used to work on both without conflicts or without having to uninstall the other application or without changing the port to 3307 in the my.ini file. Now restart the xampp control panel and start the server on port 3306. This worked for me.

Hope this helps!

-1

You need to update window. That worked for me

Bhargav Rao
  • 50,140
  • 28
  • 121
  • 140