How to start/stop MySQL server on Linux

  •  To Start MySQL Server
    /sbin/service mysqld start
  • To Stop MySQL Server
    /sbin/service mysqld stop
  • To Restart MySQL Server
    /sbin/service mysqld restart
And of course there is the brute force way to kill all the processes:
$ for i in `ps -ef |grep mysqld |awk '{print $2}'`; do `kill -9 $i`; done

Thanks to Anthony Eden for the comment (below) to remove the dot in front.

A simpler alternative is:
pkill mysqld

This will kill the mysqld process. However the best way to stop (because it stops properly) is obviously:
/sbin/service mysqld stop

No comments: