Mysql port already in use - mysql

180718 12:43:04 [ERROR] Can't start server: Bind on TCP/IP port. Got error: 10048: Only one usage of each socket address (protocol/network address/port) is normally permitted.
180718 12:43:04 [ERROR] Do you already have another mysqld server running on port: 3306 ?
180718 12:43:04 [ERROR] Aborting
is there any solution for it? Mysql is running on windows based server.
Please give the best solution..

Either a second instance of MySQL or another service is running on port 3306.
You can either stop the service which is running on port 3306 by
getting the process id of that service:
netstat -a -n -o | find "3306"
and then killing that process (e.g. for process id 1234):
taskkill /pid 1234 /f
or run MySQL on a different port.

I had also faced the problem. I stopped the "docker desktop" app(you have to stop from the app if you stop it from the task manager then it will restart automatically).it works for me.

I had a similar problem, I solved it by executing the command to get the PID using the same port:
netstat -a -n -o | find "3306"
After you get the PID, go to Task manager > Services and right click on the service with the same PID, and press stop.

The issue is because mysql workbench uses port:3306 when you try to connect it through PhP platform and the port can only be used by one app so xampp is deprived of it, the reason it's aborting.

Related

[ERROR][Server] Do you already have another mysqld server running on port: 3306?

When i type mysqld --console(picture 1)
I get the error that I have another mysql server running on port 3306 (picture 2)
How can I find and delete the other mysql running on port 3306?(from command line)
First identify the PID of the process using port 3306
netstat -aon
Stop the task by
taskkill /pid 1234 /f
Replace 1234 with the PID of port 3306

Kill parent of mysqld process on MacOS

I have a Docker machine, and I want it to be able to use port 3306. But that port is already in use.
I don't remember installing MySQL on the host machine, but I've done a lot of dumb things over the years, so there's a good chance I did. I run brew services list to see if it's a brew service that is blocking the port. Nope. Nothing is listed.
So I run sudo lsof -i tcp:3306 and get the following:
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
mysqld 71046 _mysql 28u IPv6 0xbdab224a8a9b989f 0t0 TCP *:mysql (LISTEN)
OK. Simple to kill, right? I run sudo kill -QUIT 71046 and run sudo lsof -i tcp:3306 again. Now there's a different process listening on the same port:
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
mysqld 71207 _mysql 28u IPv6 0xbdab224a8a9ba41f 0t0 TCP *:mysql (LISTEN)
This process goes on as many times as I care to repeat it. Trying to run mysql or mysqld runs into a command not found error.
So my question: What command do I have to run to permanently stop mysqld from respawning ad infinitum?
(Bonus points if you can help me get rid of the setting that starts it automatically when my machine starts.)
I gave a comment above that led you to the answer, but here's a more full explanation for the benefit of future readers:
I infer you are on MacOS because you mention brew. MacOS is weird because there are multiple ways to run MySQL Server. Brew is one of them, but the official download from MySQL.com uses a native package installer, and creates a launch daemon and a System Preferences pane to manage the launch daemon.
https://dev.mysql.com/doc/refman/5.7/en/osx-installation-prefpane.html
You can use the preferences pane to start and stop the launch daemon, or enable/disable its automatic startup.

Docker: Error response from daemon: Bind for 0.0.0.0:3306 failed: port is already allocated

I'm new to Docker and I can't seem to get my mariadb container running. I have just freshly installed Docker on Macbook Pro running High Sierra.
I've simple used this command:
docker run --name db -e MYSQL_ROOT_PASSWORD=test -d -p 3306:3306
mariadb
Which is supposed to create an image and run the container from it. But I get the following error:
docker: Error response from daemon: driver failed programming
external connectivity on endpoint db
(d4d6631ae53d644b5c28a803d5814a792c7af6925ebcf84b61b49b4a0fe30f4b):
Error starting userland proxy: Bind for 0.0.0.0:3306 failed: port is
already allocated.
So far I may have used MySQL in the far past, but I'm pretty sure I don't have anything running on port 3306.
I have also tried not adding the -p tag, it will run when I use this but when i execute docker ps it will show 3306/tcp and NOT 0.0.0.0:3306->3306/tcp as the PORT.
I have also tried just having to port tag as -p 3306 but this will show 0.0.0.0:32769->3306/tcp as the PORT in docker ps.
I would love some help. Thanks in advance.
Use lsof command to check if a service / process is using the port 3306.
$ lsof -i tcp:3306
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
mysqld 721 krisnik 34u IPv4 0x348c24a60c9d72a9 0t0 TCP localhost:mysql (LISTEN)
Now kill / stop the service.
kill -9 <PID>
Re-run your Docker container. It should work fine as the required port is released.
Edit - 1
If lsof doesn't catch the process, netstat can also be used.
sudo netstat -lpn |grep :3306
kill -9 PID //PID processID used by 3306 Port
Ref - Port 3306 busy but no process using it

Apache and MYSQL not starting in XAMP

I have a problem here that I had my XAMP up and running, I installed ZEND Framework, ZEND Server and ZEND Studio into my system. Now the problem is that localhost is not working. I researched to find out that both can be on a pc and run but I will have to choose between the apache for the two. I stopped the services of Apache Zend but my localhost did not start.
I also checked the error log of apache the last entry is of Today i.e. Tue 10:28am. and XAMP control panel just displays cannot start apache service.
I have changed the apache config file by changing the localhost server port to 8080 instead of 80. But no success yet. MYSQL is also shutting down unexpectedly.
Any help is appreciated.
I have a same problem when I installed Skype. Skype by default use 80 port number. So you can change it from Skype`s options. For more info see this link..
http://www.youtube.com/watch?v=n7wj1aaNwbU
Try to run this below command in cmd prompt
netstat -ano|find "port no"
Eg:
netstat -ano|find "3306"
TCP 0.0.0.0:3306 0.0.0.0:0 LISTENING 5164
TCP [::]:3306 [::]:0 LISTENING 5164
You could even use the pid number and check in windows task manager who is utilizing these pid so that you would come to know the exact process name
Please provide error log file if possible.

MySQL Cluster - [ [ndbd] ERROR -- Couldn't start as daemon, error: 'Failed to open logfile ]

recently I want to set up mysql cluster, one Mgmt node, one sql node and two data node,
it seems successfully installed and Mgmt node started, but when I try to start data node, I hit a problem...
here is the error message when I try to start data node:
Does anyone know what's going wrong?
basically I follow the step by step tutorial on this site and this site
It would be very appreciated if you can give me some advice!
thanks
Okay, I came up with a solution to fix this issue : 013-01-18 09:26:10 [ndbd] ERROR -- Couldn't start as daemon, error: 'Failed to open logfile
I was stuck with the same issue and after exploring I opened the $MY_CLUSTER_INSTALLATION/ndb_data/ndb_1_cluster.log
1.I found the following message present in the log:
2013-01-18 09:24:50 [MgmtSrvr] INFO -- Got initial configuration
from 'conf/config.ini',
will try to set it when all ndb_mgmd(s) started
2013-01-18 09:24:50 [MgmtSrvr] INFO -- Node 1: Node 1 Connected
2013-01-18 09:24:54 [MgmtSrvr] ERROR -- Unable to bind management
service port: *:1186!
Please check if the port is already used,
(perhaps a ndb_mgmd is already running),
and if you are executing on the correct computer
2013-01-18 09:24:54 [MgmtSrvr] ERROR -- Failed to start mangement service!
2.I checked the services running on port on my Mac machine using following command:
lsof -i :1186
And sure enough, I found the ndb_mgmd(s):
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
ndb_mgmd 418 8u IPv4 0x33a882b4d23b342d 0t0 TCP *:mysql-cluster (LISTEN)
ndb_mgmd 418 9u IPv4 0x33a882b4d147fe85 0t0 TCP localhost:50218->localhost:mysql-cluster (ESTABLISHED)
ndb_mgmd 418 10u IPv4 0x33a882b4d26901a5 0t0 TCP localhost:mysql-cluster->localhost:50218 (ESTABLISHED)
3.To kill the processes on the specific port (for me : 1186) I ran following command:
sof -P | grep '1186' | awk '{print $2}' | xargs kill -9
4.I repeated the steps listed in mySql Cluster installation pdf again:
$PATH/mysqlc/bin/ndb_mgmd -f conf/config.ini --initial --configdir=/$PATH/my_cluster/conf/
$PATH/mysqlc/bin/ndbd -c localhost:1186
Hope this helps!
Hope this will be useful
In my case, two data node were connected already
you can check this out in your management node
[root#ab0]# ndb_mgm
-- NDB Cluster -- Management Client --
ndb_mgm> show
what i did was
ndb_mgm> shutdown
and then execute the restart command. it works for me
Check that the datadir exists and is writeable with "ls -ld /home/netdb/mysql_cluster/data" on datanode1.