Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am doing the following in order to shutdown mysqld in order to not have an open 3306 port

sudo mysqladmin -u root -p shutdown

However afterwards when I use netstat, mysqld is still listening on port 3306 just having a new PID. So what is automatically creating a new process and how do I stop it ? pkilling the process has the same result.

share|improve this question

migrated from stackoverflow.com Sep 21 '11 at 21:36

This question came from our site for professional and enthusiast programmers.

    
What flavor of Linux? Try /etc/init.d/mysqld stop. –  Perception Sep 21 '11 at 20:16
    
Ubuntu Server 11. Will try, thank you. –  StartingOut Sep 21 '11 at 20:17
    
@Perception: Answers as answers, please. –  Lightness Races in Orbit Sep 21 '11 at 20:19
    
Thank you, it worked: There was no mysqld but only mysql and doing /etc/init.d/mysql stop resulted in being asked to use the service –  StartingOut Sep 21 '11 at 20:22
    
utility and sudo service mysql stop resulted in removing mysqld –  StartingOut Sep 21 '11 at 20:23

2 Answers 2

This done by the following command:

sudo /etc/init.d/mysqld stop

Edit to be more precise: Note that this command only works on certain machines. This might help, but it is possible your distribution does not support this.

share|improve this answer
1  
Sometimes. On some systems. –  Lightness Races in Orbit Sep 21 '11 at 20:18
    
In most cases, on most linux systems and probably the one he is using ;-). You don't have to provide an every situation answer. If he doesn't has this we can look further ;-). –  JNDPNT Sep 21 '11 at 20:20
    
At least indicate this in the answer though! At present it reads as a catch-all answer when it's not. –  Lightness Races in Orbit Sep 21 '11 at 20:41
    
Done, thanks for your feedback. –  JNDPNT Sep 22 '11 at 5:40
    
No problem! :-) –  Lightness Races in Orbit Sep 22 '11 at 8:51

What distro are you using? Often you'll want to use the start/stop script to shut it down, as there may be a monitoring process that thinks that mysqld should be running, so when it no longer is it starts it back you.

You can also just firewall off port 3306, so only localhost can access it. Might be easier in the long run.

share|improve this answer
    
+1: I like that. Just firewall it up. –  Lightness Races in Orbit Sep 21 '11 at 20:19
    
Doesn't seem like a good idea to turn your firewall of unless it is controlled and safe. Seems unnecessary in this case ;-). –  JNDPNT Sep 21 '11 at 20:22
1  
Uh...who said anything about turning off the firewall? I suggested firewalling off the mysqld port. –  Drizzt321 Sep 21 '11 at 20:40
    
And by firewall off, meaning make inaccessible to everything but localhost. –  Drizzt321 Sep 21 '11 at 20:41

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.