MySQL startup error - port is already in use - php

I get the following error while trying to start XAMPP:
12:34:26 PM [mysql] Attempting to start MySQL service...
12:34:38 PM [mysql] Problem detected!
12:34:38 PM [mysql] Port 3306 in use by ""C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqld" --defaults-file="C:\Program Files\MySQL\MySQL Server 5.1\my.ini" MySQL"!
12:34:38 PM [mysql] MySQL WILL NOT start without the configured ports free!
12:34:38 PM [mysql] You need to uninstall/disable/reconfigure the blocking application
12:34:38 PM [mysql] or reconfigure MySQL and the Control Panel to listen on a different port
12:34:38 PM [mysql] Attempting to start MySQL service...

The log cleraly states that another application is listening on port 3306, so it is not possible to start MySQL since 3306 is the configured port for it (default port for MySQL connections). This application that already listens on por 3306 is another instance of MySQL that's probably configured to start automatically.
If you are using Windows, click the Start button, then Execute, then type services.msc and press [Enter]. Look for the running MySQL service, stop it, and configure it to prevent its launching on system startup. After that you should start XAMPP normally.

open xampp control panel.
click on "config" button.
click on "service and port settings".
click on "mysql" tab.
change the value labeled "Main Port" to 3307

So, mysql is listening 3306 port by default. According to your error,some service has already used it.
Depends on your OS,check who are using it. For example for netstat -lp | grep 3306, you can close this service and restart your mysql or change to another port OR you an change mysql default port to listen in your my.cnf file.

may be you have previously installed xampp app and left in before complete installation and then reinstalled it before uninstalling previous one just uninstall privious one or uninstall both and reinstall

Well my friend told me to reinstall xampp in C drive and it did worked but after some time i was facing same problem again so i followed this steps hope it will be helpfull.
Open cmd as administrator
If there's nothing important running on port number 3306 kill that process.
enter image description here
Follow this steps:
(In case photo have any error)
after opening cmd as administer run command
netstat -ano |findstr 3306
Then observe the PID at last column if there is only one process running shut it down.
taskkill /F /PID portidnumber
In case you get error even after doing that try to do follow the steps here:
I experienced that if we try to stop mysql before apache it is giving error.
So when you go to stop process or server stop apache first and then mysql.
And don't shutdown xampp without stopping any server
(I found this by web search and some try and error and it's working for me at least)

Related

Unable to start Apache module in xamp server

I have recently installed xamp server for the first time and want to run a php website on the local server. When I start Apache module in xamp server then it shows following error however MySQL starts and runs fine:
9:04:58 PM [Apache] Attempting to start Apache app...
9:04:58 PM [Apache] Status change detected: running
9:04:58 PM [Apache] Status change detected: stopped
9:04:58 PM [Apache] Error: Apache shutdown unexpectedly.
9:04:58 PM [Apache] This may be due to a blocked port, missing dependencies,
9:04:58 PM [Apache] improper privileges, a crash, or a shutdown by another method.
9:04:58 PM [Apache] Press the Logs button to view error logs and check
9:04:58 PM [Apache] the Windows Event Viewer for more clues
9:04:58 PM [Apache] If you need more help, copy and post this
9:04:58 PM [Apache] entire log window on the forums
I am doing this for my software testing assignment. I have to test a website on local server and for that I have installed xamp server. Can anyone help?
In some cases Some ports are blocked by your network admin or ISP (although, I would not recommend running Xampp as a publicly accessible server).
And port 80 is used by some other applications like Skype,etc.. when you want to access both Apache and those applications some conflicts may occurs for this problem you have a option to change the port number for Apache server
If your Apache server is not working then it shows that some other applications is using port 80
Let do it manually.
Step 1: For this process first of all open httpd.conf file which is located xampp\apache\conf\
In my system my xampp is installed in c drive so my path is c:\xampp\apache\conf
your’s may be different from this
so now open httpd.conf file using a text editor or programmer’s editor (i am using notepad++)
Now locate the line that says Listen 80. It is line #47 or else press contol+f and type 80 then it will automatically moves courser to here then change 80 to your own port here i am using 3388.
After that save the file by pressing control+s.
After successful save Restart the Apache server your port number is successfully changed
There could be many possible answers to this. The most common one is another program running on port 80. I had the same problem and then I found that my Vagrant box was running on port 80.
If you have skype installed on your computer, then change your apache's port to something else.
To do so, go to xampp/apache/conf/httpd.conf and change following line in httpd.conf:
ServerName localhost:80
to
ServerName localhost:81
Furthermore, if it doesn't work, change the following line as well:
Listen 80
to
Listen 81
Sometimes ,this error occurs due to same port use by other software on your Computer ,So u should have to change the port number or disable the same port no from other software like virtual box etc

xammpp error (i have this error while installing Xampp and apache. how do i handle it?)

XAMPP Installation Directory: "e:\xampp\"
Checking for prerequisites
All prerequisites found
Initializing Modules
***
Problem detected! Port 80 in use by "Unable to open process" with
PID 4! Apache WILL NOT start without the configured ports free! You
need to uninstall/disable/reconfigure the blocking application or
reconfigure Apache and the Control Panel to listen on a different port
XAMPP Apache Service is already running on port 443
XAMPP MySQL Service is already running on port 3306
***
Problem detected! Port 8080 in use by
""E:\xampp\apache\bin\httpd.exe" -k runservice"! Tomcat WILL NOT
start without the configured ports free! You need to
uninstall/disable/reconfigure the blocking application or reconfigure
Tomcat and the Control Panel to listen on a different port
Starting Check-Timer
Control Panel Ready
Executing "services.msc"
Attempting to stop Apache service...
Attempting to stop MySQL service...
Status change detected: stopped
Status change detected: stopped
I disabled bluetooth and all other running connections and applications,and it worked fine for me

MySQL won't start on xampp (Windows)

This problem started when I didn't properly hibernate my laptop. Every time I open xampp, I can't start MySQL. I searched for online answers but nothing happened. I tried changing the port from 3306 to 3307 to 80, still nothing happened.
So I uninstalled xampp and install it again. After installing, I tried to start Apache and MySQL. Worked fine with Apache but on MySQL, I got this error log:
4:52:15 PM [mysql] Error: MySQL shutdown unexpectedly.
4:52:15 PM [mysql] This may be due to a blocked port, missing dependencies,
4:52:15 PM [mysql] improper privileges, a crash, or a shutdown by another method.
4:52:15 PM [mysql] Press the Logs button to view error logs and check
4:52:15 PM [mysql] the Windows Event Viewer for more clues
4:52:15 PM [mysql] If you need more help, copy and post this
4:52:15 PM [mysql] entire log window on the forums
It's usually because of Skype (or any other program that uses MySql port). Go to Skype Options > Advanced > Connection type in alternative port (e.g. 42795) and uncheck "Use port 80 and 443..."

XAMPP - MySQL shutdown unexpectedly

I installed XAMPP on Windows 8 (64bit). In XAMPP Control Panel i can't start mySQL. I changed the port of mySQl in "C:/xampp/mysql/bin/my.ini" from 3306 to 3307 according to that link:
xampp MySQL does not start
now the code in "my.ini" changed to:
[client]
# password = your_password
port = 3307
socket = "C:/xampp/mysql/mysql.sock"
# Here follows entries for some specific programs
# The MySQL server
[mysqld]
port= 3307
socket = "C:/xampp/mysql/mysql.sock"
Now it still gives that error:
11:31:48 AM [mysql] Attempting to start MySQL service...
11:31:56 AM [mysql] Status change detected: running
11:32:01 AM [mysql] Status change detected: stopped
11:32:01 AM [mysql] Error: MySQL shutdown unexpectedly.
11:32:01 AM [mysql] This may be due to a blocked port, missing dependencies,
11:32:01 AM [mysql] improper privileges, a crash, or a shutdown by another method.
11:32:01 AM [mysql] Press the Logs button to view error logs and check
11:32:01 AM [mysql] the Windows Event Viewer for more clues
11:32:01 AM [mysql] If you need more help, copy and post this
11:32:01 AM [mysql] entire log window on the forums
I deleted "ibdata1" file in "C:\xampp\mysql\data".
also stopped mysql56 service.
Any help is appreciated. Thanks
Check the error logs to view more details on the subject. Check that mysql and mysqli port options in my.ini and php.ini and in config.inc.php match and are 3307.
In case MySQL Server has crashed you might want to take a look at Forcing InnoDB Recovery
In addition take also a look at this solution in case it is a 3rd party software issue.
Just like #Peter said, you need to change that file configuration.
Try to change this in your xampp folder ex: C:\xampp\php\php.ini:
mysql.default_port=3307
mysqli.default_port=3307
And change this parameter in your xampp folder ex: C:\xampp\mysql\bin\my.ini :
[client]
# password = your_password
port = 3307
socket = "C:/xampp/mysql/mysql.sock"
[mysqld]
port= 3307
To fix this issue,
Right click and open task manager
kill process "mysqld".
Open Xampp and start MySQL.
This really works!!
References:
https://www.youtube.com/watch?v=jcaqDv0f8K4
Just open task manager and forcefully end the task named mysqld.exe. And then try once again.

Why won't Apache start in XAMPP installation?

I've taken the first steps to learning PHP - think it would be a good step in the right direction. I would like some help however on installing XAMPP. I have downloaded the file and all that through the Apache Friends site, but when I head to to control panel, I get numerous errors.
This is what it says for me:
**10:21:53 [Apache] Problem detected!
10:21:53 [Apache] Port 80 in use by "Unable to open process" with PID 4!
10:21:53 [Apache] Apache WILL NOT start without the configured ports free!
10:21:53 [Apache] You need to uninstall/disable/reconfigure the blocking application
10:21:53 [Apache] or reconfigure Apache and the Control Panel to listen on a different port
10:21:53 [Apache] Problem detected!
10:21:53 [Apache] Port 443 in use by "C:\Program Files (x86)\Skype\Phone\Skype.exe" with PID 3748!
10:21:53 [Apache] Apache WILL NOT start without the configured ports free!
10:21:53 [Apache] You need to uninstall/disable/reconfigure the blocking application
10:21:53 [Apache] or reconfigure Apache and the Control Panel to listen on a different port
10:21:53 [main] Starting Check-Timer
10:21:53 [main] Control Panel Ready**
Could someone please tell me what this means and how I remedy it? Thanks very much.
It seems that port 80 and 443 is used by another program. From my experince - open Skype. Go to Tools -> Options -> Advanced -> Connection. Please uncheck "use port 80 and 443 as alternatives...."
Then, try to restart Apache.
I tried this and it worked really well...
As you have already figured the port 80 is in use by something with pid 4
This application's detailed info can be seen using the details tab on the task manager window.
However I found out the application is not writable and hence I figured it shouldn't be touched.
Instead I changed the port of the apachae server on xampp to be 85
Open xampp and click on config in front of apache then select the first option that appears allowing you to open httpd.conf and then in the notepad file that opens up, find the word listen and go to the 4th word that it finds.
It will read something like Listen 80
Change this to any number except 80 (like 85) and voila it work
Opening the XAMPP control panel as Administrator worked for me.
The solution for me was to:
1) Stop IIS (stop the "World Wide Web Publishing Service" and set its startup type to Manual)
2) Stop the "Web Deployment Agent Service" and set its startup type to Manual.
...as detailed in http://www.sitepoint.com/unblock-port-80-on-windows-run-apache/
Port 80 in use by "Unable to open process" with PID 4!
A process with a PID of 4 that is taking port 80, is almost always the Window's HTTP.SYS Service. It's a type of a proxy service for other services. And it's safe to disable it in most cases.
From command-line, Run As Admin.
net stop http
sc config http start= disabled
Or you can switch it's Startup Mode to "On Demand".
For more options and also a list of other port 80 Services see Opening Up Port 80 For Apache to Use On Windows.
Steps which u can try:
1) uninstall or stop Skype and check again after restarting the server.
2) use this to get the port usage details : use cmd netstat -a -b
3) or use this GUI tool to identify the ports used by other programs.
4) uninstall Xammp and try with Wamp Server
in my case a website was configured on IIS , i stopped and it worked well.
You have to close down Skype. It tells you exactly why it can not start in the error message.

Categories