I am currently running macOS High Sierra version 10.13.6.
This is what I get when I load localhost:8080 in my browser:
Apache / PHP server screenshot
I do not know how this server was started on this port because I have never used these technologies. I do mess around with web development every now and then, but I do not know what I was doing when the server started. I have looked into how to kill the process and so far the closest I have come to ending the server is killing my chrome browser. Some of the things I have tried to find the process running on port 8080:
ps aux | grep 8080
lsof -t -i #localhost:8080
netstat -l -p | grep 8080
lsof -nP -i | grep 8080
There were a few more ones that looked similar that I tried, but I cannot recall all of them. When using the lsof commands, I would usually have to put sudo in front of them for anything to show up. I would sometimes get nothing to come back and sometimes I would get something like this: Terminal output from lsof and ps aux output where the Postgres processes are.
When I got processes back that had a PID associated with them, I would try to kill them with kill -9 <PID>. Normally I would have to force this with sudo because it gave me a permission denied error (probably not the best practice). When I did this, nothing appeared to happen except other processes appeared when I searched after I killed the initial ones. I also tried to end the processes associated with Postgres from ps aux, but that did not work either. It just seems like whatever processes I am finding are not the correct ones. Does anyone have any suggestions to help me find and kill the process that is hosting the server?
From the command line it would be:
sudo /usr/sbin/apachectl stop
To prevent it from starting at the next reboot:
sudo launchctl unload -w /System/Library/LaunchDaemons/org.apache.httpd.plist
Note that I have no idea what else uses apache on your system, so this might break things.
You could try with:
ps -e | grep httpd
This will show you apache httpd PIDs.
Another way is to install pstree using brew:
brew install pstree
pstree will show running processes as a tree. Then You can find the PPID with the following command:
pstree | grep httpd
Then you can use kill to terminate the process. I tested both ways on macOS High Sierra.
lsof -nP -i | grep "TCP.*:8080.*LISTEN"
Use lsof to find the process that is waiting for connections ("LISTEN"ing) on port 8080. Use the PID column from that output to kill the process.
Im running put of patient with SELinux and that stuff...
I have httpd and myslqd running on the same machine with CentOs 6, and both services have their configuration files in a nfs directory exported from another machine.
Everything works fine with Selinux disabled... but when I set it to enforcing, PHP scripts can not communicate with mysql service. Httpd service works fine and mysqld too, if I run "mysql -u root" I can make queries to the database perfectly, but php scripts can not.
I think I'm missing some sebool that allows php to use mysql or something like that, but i can not find the key... some help?
You can set the following flag to allow Apache to connect to a database.
setsebool -P httpd_can_network_connect_db on
The -P option makes the change persist across reboots. You may need sudo to execute this command.
I have to make Laravel app and to deliver a Dockerfile, but I'm really stuck with this. Before that I had a nightmare wile installing laravel on my machine.
I'm trying to get dockervel image and following the steps here:
http://www.spiralout.eu/2015/12/dockervel-laravel-development.html
But when I run dartisan make:auth it gives this error below:
**ERROR:** for dockervel_mysql_1 **Cannot restart container** c258b418c03cbd6ec02c349c12cf09403f0eaf42fa9248019af7860d037d6474: **driver failed programming external connectivity on endpoint dockervel_mysql_1** (da3dd576458aa1fe3af7b539c48b9d61d97432cf5e9ee02d78562851f53981ae): E**rror starting userland proxy: listen tcp0.0.0.0:3306: bind: address already in use.**
I have tried to Change the default port in the docker-compose.yml
ports:
- "8084:80"
Still nothing, also tried to stop apache2 (service apache2 stop) on my machine ,also tried docker-compose restart and removing docker container dockervel_mysql_1.
I have to mention that I have already one Laravel proj. in /var/www/laravel.
Please help!
I had the same problem and
sudo netstat -nlpt |grep 3306
showed me the PID and which service it was started by (mysgld). Whenever I tried to kill the PID then it was started again. But the problem was fixed when I stopped the service by
sudo service mysql stop
Notice that you will have to use mysql and not mysqld.
I hope that this will do it for you - I was able to run docker-compose up without any problems
Try to kill all the processes using the port 3306:
sudo kill `sudo lsof -t -i:3306`
Then, run your docker containers:
sudo docker-compose up
Probably you have already a MySQL service running in port 3306. You should close it first.
Then try to end docker-compose down and restart it with docker-compose up.
Remember also to change the permissions after you add a file in your project (like dartisan make:auth) with dpermit
UPDATE:
since you have changed the port to "8084" you should go to localhost:8084
If you see the apache default then you probably are browsing another server since dockervel is build upon nginx.
You have also probably have some gaps on Docker. Don't mix your local storage with docker storage. /var/www in a container is different than your local /var/www. in docker-compose.yml you mount the local ~/dockervel/www to containers /var/www.
I would suggest that you start all over again and revert the changes you've made to your apache server. Shut it down, you don't need it. Dockervel will provide you with an NginX server in a container.
My fix for this issue was to go into
docker-compose.yml
and change
ports: -3306:3306 to ports: -3307:3306
then run this command again:
docker-compose up
On Ubuntu, running this command will stop your mysql from running for your docker container to work:
sudo service mysql stop
Then, if your apache2 is running, you need to stop the service especially when you want to work with nginx:
sudo service apache2 stop
Then, you can run your docker-compose up -d ... command
So for me when I was trying to load and run MySQL image in docker container, I was getting the same error:
And even after stopping local mysql server in system preferences didn't help:
Cause the port 3306 was used by my tomcat server, so basically you have to make sure the port (in this case 3306) that the docker command wants to use should not be in use by any other service otherwise the command will fail
First Solution :
sudo service mysql stop
and then run
docker-compose up
to start the application , It is an quick and fast solution to run this mysql stop command to stop the current MySQL service on port 3306 port so the same port can be available for your docker application.
Scenario 1 : Problem will come when you want to run both application one which was running previously and next you want to run now at this time it won't work.
Second Solution to Scenario 1:
If your next/current application coming from docker then try below it will work without disturbing first application mysql service of 3306 port
Open and changed the MySQL port from docker-compose.yml file
Default configuration
ports:
- ${SERVER_PORT_DB:-3306}:3306
changed port
ports:
- ${SERVER_PORT_DB:-3307}:3306
and now run below command to start the application
docker-composer up
The error you are seeing is from a local mysql instance listening on port 3306 (currently on pid 1370 from your comments). You won't be able to run a container that publishes on this host port while it's already in use by another process. Solutions are to either stop mysql on the local host, or to change/remove the published port in your container. If the port is only needed by other containers, you can leave it unpublished and they can communicate directly on the docker private network (by default, this is "bridge").
This option did it for me:
sudo pkill mysql
You need to change the mysql port
because you are installing mysql on your machine and it takes the default port 3306
and now you are trying to make dockervel_mysql_1 run to the same port 3306 , this is why you see in the error "Address already in use"
so if you change dockervel_mysql_1 port to 3307 for example it will works fine , without stopping the mysql that is running on you machine
Running this command fixed the issue for me:
docker swarm leave --force
Explanation:
I had started docker swarm service as a master node in my localhost.
Swarm was taking network priority and making use of this ports already
If tomcat is running on your machine which is connected to MySQL 3306 port then check by killing the tomcat first and then trying to do docker-compose up.
I used two different versions of MySQL, MySQL 5 on my local machine and 8 on docker. So when your connected to mysql5 on 3306 in tomcat and if you just stop the mysql5, then the process isn't completed yet since tomcat is still connected to 3306. Kill the tomcat and then up the docker it should work.
Happy coding!!
I know this question has been quite old but someone still looking for answers. You don't have to run any kill command instead you can use docker --remove-orphans flag and it will clean it up for you. For example
docker-compose up -d --build --remove-orphans
This worked for me, just changed the app's port to 8084:80, like described here.
So I was trying to reset my MySQL password on my Raspberry Pi and it seems that my database crashed or is now inaccessible.
I was following the section called, “B.5.3.2.2 Resetting the Root Password: Unix and Unix-Like Systems” of the official MySQL documentation.
As soon as I ran:
kill `cat /var/run/mysqld/mysqld.pid`
Then input:
# sudo service mysqld restart
I’d get:
# mysqld: unrecognized service
I hope that I didn’t just nuke my entire database. Can someone help?
You are following generic MySQL instructions for a Linux setup when you are on a Raspberry Pi using Raspbian (I assume).
All that message means is the service named mysqld is unrecognized by your system. It does not mean it has crashed or data was lost. It just means your OS doesn’t know what mysqld is as far as services go. That’s it; nothing to panic about.
A quick Google search shows that Raspbian uses a different system service name simply known as mysql. So to start it up again just run this command:
sudo service mysql start
And you should be good to go. Also note that whole command you ran to stop the service is overkill:
kill `cat /var/run/mysqld/mysqld.pid`
Running a kill command like that should only happen when all other options are exhausted and you truly want to stop the database server. The way you should be stopping, starting and generally controlling the MySQL server is via the service interface using a command like this:
sudo service mysql stop
And if you wanted to restart the service, just run this command:
sudo service mysql restart
Past any of that if you are stuck with an “unrecognized service” message, then you can always check the stuff in the /etc/init.d directory on your Linux machine like this:
ls -la /etc/init.d/
Look through that list and find the exact name of the service you need to do something with and then just run the service command as outlined above.
I have been using mySQL for a few weeks now with PHPMyAdmin with no problems. But just lately it stopped working - MySQL server will run for a few seconds when I start my machine (Mac OS X 10.9.5)then it crashes and wont restart. It also wont let me log in PHPMyAdmin.
When i try to run mysql through terminal it returns the following error:
Can't connect to local MySQL server through socket '/tmp/mysql.sock
I'm not really sure what could cause this after it working for so long.
mysql on the command line/terminal is just another MySQL client, like phpMyAdmin or your web application. The error you're seeing is the same error as phpMyAdmin is displaying. On linux/OSX the command is actually mysqld (d for Daemon or server).
Homebrew/Macports/etc installs
During installation it should have installed a launchctl script. Find it on the terminal with ls ~/Library/LaunchAgents/ and inspect the output, in my case:
homebrew.mxcl.lighttpd.plist
homebrew.mxcl.mysql.plist
homebrew.mxcl.php55.plist
There in the middle - now I can use launchctl to start it at the terminal:
$ launchctl load ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
Although the handy launchctl script is called "mysql" it's actually launching mysqld, usually from /usr/local/bin/mysqld
Standard MySQL install
If you installed MySQL directly from their website, you should have a "MySQL" option in your System Preferences. From there you can stop/start the service.
If you didn't install mysqld with a package manager, perhaps you installed/compiled it yourself, then search your disk for mysqld and launch it from the command line or find an init.d folder with a mysqld script inside.