当前位置: 主页 > 教程 > linux常用命令 >

How to start/stop MySQL server on Linux linux中停止/启动

编辑:admin 日间:2009-10-02 23:07

# 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