'Can't start MySQL, port 3306 busy

I'm trying to start MySQL from XAMPP (under Windows Vista), but it's saying that's port 3306 is busy.

What would be the best way with check what application is using that port and how to free it?



Solution 1:[1]

In a command shell, run:

netstat -b -p TCP

or

netstat -an | grep -i listen | grep -E 3306

The first command will output a list that you will need to look through for the line that displays localhost:3306 in the second column. Below this is the application's name using the port.

The secondary command will find find the exact port you are looking for and looks something like this:

<example-name>:user <example-name>$ netstat -an | grep -i listen | grep -E 3306
tcp46      0      0  *.3306                 *.*                    LISTEN

Solution 2:[2]

Just Open task manager and Kill MySql service.

Solution 3:[3]

I had the same problem and was stuck on this thing for a day and I couldn't find a perfect answer anywhere. So I gave it a shot on my own and it worked. This solution is for Windows users. I use Windows 7.

My xampp control panel was displaying an error that port 3306 is busy and in use by some file (name was specified).. say "filename.de".

Now follow the following steps:

  1. press Ctrl+Alt+Del and open Task Manager.
  2. Open the "Processes" list and Check for "show all processes" under the list of processes. If you don't see any such option, don't worry! as sometimes administrator permission is required to show some processes.
  3. Now, when you click on "show all processes" button, all the process will be displayed.
  4. Now, switch to "services" tab in the task manager, and a list of services will be displayed. Now look for a service named "filename.de" <-- filename that was diplayed in the error message in xampp.
  5. When you find that service, 'right-click', and then click in option.. GoTo Process.
  6. You will be redirected to the "Processes" tab with focus on a process corresponding to that service. 'Right-Click' and then click on "end process tree".
  7. Now, the issue has been solved! But might have to do the same thing again when you restart your PC. So it is best to keep your PC in sleep-mode.
  8. Otherwise, to solve this issue permanently, open "msconfig" and uncheck that particular process from the services list and click on apply. and you can restart your system.

Solution 4:[4]

If mysql is not starting in xampp, it might be a port conflict issue. Mysql run by default on port 3306. you need to check if another application is occupying that port. use following command to check app occupying a port

Linux: netstat -tulpn | grep 3306
Window: netstat -a -b 
Mac: lsof -nP -i4TCP:3306

if you find an application occupying that port, stop the application and restart xampp. As an alternative, you can go to php.ini file or click configure in the xampp for mysql and change the mysql port to 3307

Solution 5:[5]

As Mentioned By @Segun Emmanuel Run the Following Command:

netstat -a -b 

You will get a list of Applications that are using different PORTS. Press Ctrl + F and write 3306 to find out which Application is using PORT 3306.

enter image description here

After this, Go to Task Manager via Search Bar or by pressing CTRL + ALT + DEL. Then Under the Background Processes, find out mysqld.exe, right-click on it and you will find an option to close it, namely "End Task".

enter image description here

Then go to your Xampp Control Panel and start the MySQL service.

enter image description here

Solution 6:[6]

I've been having trouble for hours on this error. I was trying to run MySQL from XAMPP after quite some time. It gave errors, similar to yours, it said that port 3306 is in use. If you:

  • are running on Windows 10
  • are avoiding to change the port number of MySQL from 3306
  • can't see any program using the 3306 port from netstat
  • reinstalling and deleting everything yet it still give the same error
  • are enabling and using Hyper-V
  • all of the other solutions didn't work

This is the solution that worked for me:

  • Go to the most right of the taskbar and right-click the connection icon, click Open Network & Internet settings
  • Click Change adapter options
  • Right-click and Disable everything that relates to Hyper-V

I ran MySQL again at now it works.

Solution 7:[7]

In my case it was javaw.exe which was starting on port 3306. This exe does not cause problem if I am logged in using single user in my Windows 10. But if I have multiple logins, it starts this exe for each user and blocks MySQL to start on 3306 port.

Going to task manager and killing this exe for the other user fixed the issue and MySQl could start.

Solution 8:[8]

Windows icon -> Open cmd.exe.
Type netstat -a -b.
Find what's using it. In my case it was this: Image 1

So, I went to task manager. There were no process called so. The I went to services and disabled these two:

Image 2

Now everything works fine.

Solution 9:[9]

I had this problem (slight variation as I was using MAMP)

I found this problem was due to having MySQL Workbench installed, MySQL Workbench started the mySQL service on bootup which in turn stopped MAMP being able to use the port.

To fix this I had 2 options,

  1. Uninstall MySQL Workbench
  2. Open Task, click services tab, kill the current MySQL service

This then allowed MAMP to use port 3306

Solution 10:[10]

For this problem, a simpler way on Windows is:-

  1. Go to Task Manager
  2. Go to Services
  3. There will be a services named MySQl80 right click on it and then select "Stop"
  4. Try and start the MySQl module on XAMPP server again

Solution 11:[11]

If you where not able to find any application or process listening on port 3306, you might need to check your network adapters.

  • Disable adapters you do not use.

  • Pay also attention to the Hyper-V generated network adapter, disable it if you don't need it. Sometimes it can reserve some ports and commands like netstat will not be able to find it out

Solution 12:[12]

This error occurs if you have installed mysql two times. mysql by default uses the port 3306. If you have installed it twice then already there is a mysql at your port number 3306. So you will have to change your port.

If you are using xampp then you can easily change your port. Steps to change port: Step 1: Open your xampp as administrator. Step 2: Click on 'Config' at the top right corner of your xampp. Step 3: Click on 'Service and Port Settings' and after that change the main port of mysql from 3306 to 3307 and the click on save. Step 4: Then click on 'config' which is in front of mysql and open 'my.ini' file which will be a text file. Step 5: Now wherever in the text file you see the port number mentioned as 3306 change it to 3307 and then save the file.

After doing this again start your mysql server and it will start running on port 3307.

This worked for me and I hope it will work for anyone else who encounters the same issue.

Solution 13:[13]

This command kills the existing mysql process and perhaps one can start it afresh

sudo pkill mysql

It has helped me solve this challenge most of times

1. Turn off the application which is using this port, open terminal and run "lsof -n -P -i | grep 3306" to figure out.
2. Use different ports, right click on the server -> Edit.