Xamp - mysql (3306 error) - php

Problem detected!
14:26:36 [mysql] Port 3306 in use by ""C:\Program Files\MySQL\MySQL Server 5.7\bin\mysqld.exe" --defaults-file="C:\ProgramData\MySQL\MySQL Server 5.7\my.ini" xxx (PROJECT NAME)"!
14:26:36 [mysql] MySQL WILL NOT start without the configured ports free!
I can't shake this error. Xamp Apache runs great, but can't figure out how to get mysql running.
I tried:
Change php.ini:
mysql.default_port=3307
mysqli.default_port=3307
and my.ini:
[client]
# password = your_password
port = 3307
socket = "C:/xampp/mysql/mysql.sock"
[mysqld]
port= 3307
I don't want to uninstall Mysql workbench (as it has important dbs)
Additional information (I've Installed mysql workbench - not sure if this helps or not)

You could use netstat -lp | grep 3306 to find out what program is already listening on port 3306 (you should see PID/Program name in last column) and stop that (maybe mysql is already running?).
Alternatively you could start the newly installed server on a different port. (edit my.cnf and change the default port there)

Related

Connecting to MySQL Server on Ubuntu not possible

I have set up a raspberry PI 4 with Ubuntu. Apache, PHP, mysql and phpmyadmin are installed and working fine. So when I am trying to connect from another network with my windows device over MySQL Workbench there is an error occuring.
error
Checked: port forwarding on port 80 is open. checked binding ip in mysqld.conf (maybe I made a mistake there) when I try to change the port in this configuration file to 80 and restart "sudo service mysql restart" this error occure "Job for mysql.service failed because the control process exited with error code"
So maybe mysql is not listening to port 80. I have checked sudo lsof -i :80. Only found records from apache listening to port 80.
I am trying for three days now to connect to the database.
Thank you for your help guys!
By default, mysql listens on port 3306, so if you are trying to connect directly to mysql, that could be the issue. Port 80 and 443 are for http/https respectively.
You can't set the port to port 80 because apache needs that port to listen for http requests.
Try setting the port back to 3306 on the mysql host machine and seeing if that works. You may also need to open that port on the host machine as well.

Port problems installing XAMPP

Hello I am installing XAMPP and I am having a problem with MySQL port 3306.
I have used the control panel config my.ini and changed the port settings to 3307 and it is still showing the following error:
22:48:55 [mysql] Problem detected!
22:48:55 [mysql] Port 3306 in use by "C:\Program Files\MySQL\MySQL Server 5.7\bin\mysqld.exe" --defaults-file="C:\ProgramData\MySQL\MySQL Server 5.7\my.ini" MYSQL57"!
22:48:55 [mysql] MySQL WILL NOT start without the configured ports free!
22:48:55 [mysql] You need to uninstall/disable/reconfigure the blocking application
22:48:55 [mysql] or reconfigure MySQL and the Control Panel to listen on a different port
on Windows+R write cmd and press enter
on command line write:
netstat -nap tcp
and press enter, LISTENING are port used, search for 3307
for view name process use (execute how administrator):
netstat -nabop tcp

MySQL startup error - port is already in use

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)

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.

I am unable to use MySQL due to a "refused connection"

I am trying to run the no-install version of MySQL on Windows XP located in C:/mysql/ on my machine.
The error message I receive within a PHP file when I try to connect to MySQL reads.
Could not connect: No connection could be made because the target machine actively refused it
I have edited the config file my.ini and altered/added the following.
[client]
port = 3306
socket = C:/mysql/tmp/mysql.sock
[mysqld]
port = 3306
socket = C:/mysql/tmp/mysql.sock
basedir = C:/mysql/
datadir = C:/mysql/data/
bind-address = 127.0.0.1
skip-networking
enable-named-pipe
When I run mysqld.exe I can confirm it is running within command prompt tasklist.
However when I try cmd netstat -a I cannot see any port usage at 3306.
Inside MySQL error logs, it reads.
140411 13:30:34 [Note] c:\mysql\bin\mysqld.exe: ready for connections.
Version: '5.5.37-log' socket: '' port: 0 MySQL Community Server (GPL)
The port: 0 doesn't look correct to me, but I am not sure.
When I run mysql.exe direct in cmd I get the following returned
ERROR 2003 (HY000): Can't connect to MySQL server on 'localhost' (10061)
Some things I have tried already.
Placing a copy of my.ini in C:/WINDOWS and also a copy within C:/mysql
Changing bind-address = 127.0.0.1 to bind-address =
localhost
Inside PHP file MySQL connection variants, localhost, 127.0.0.1, 127.0.0.1:3306 inside basic mysql_connect()
Created tmp/mysql.sock file (in case dir + file not existing matters)
Commented out skip-networking in my.ini
After running mysqld.exe whilst running ran mysqladmin.exe in cmd which returns 'Can't connect to MySQL server at 'localhost'
Running telnet localhost 3306 returns
'Connecting To localhost...Could not open connection to the host, on port 3306: C
onnect failed'
Commented out bind-address in my.ini to allow default settings.
Ran mysqld.exe with user root (-u root) also inserted user = root in my.ini
Set Windows Firewall to off.
Thanks in advance.
Ok. You have binded your server to specific ip so please read this MySQL bind-addres. Please unbind your server and check if you have proper user. (last paragraph in documentation)

Categories