linux服务相关操作

=======================================================

mysql 启动与停止

 

手动安装版本:

启动

cd /usr/local/mysql

./bin/mysqld_safe --user=mysql &   //启动MySQL,但不能停止

 

停止

/usr/bin/mysqladmin -u root -p shutdown  

 

 

rpm 安装版本:

/etc/init.d/mysql start

/etc/init.d/mysql stop

/etc/init.d/mysql status

 

 

存在mysql 服务:

service mysql start 

 

=======================================================

nginx 启动与停止

启动 

/usr/local/nginx/sbin/nginx

 

平滑启动不重启

/usr/local/nginx/sbin/nginx -s reload

 

强制停止Nginx:

pkill -9 nginx

 

修改配置后检测

/usr/local/nginx/sbin/nginx -t

 

=======================================================

apache 启动与停止

apahce启动命令:

/usr/local/apache2/bin/apachectl start  启动

apache停止命令

/usr/local/apache2/bin/apachectl stop   停止

apache重新启动命令:

/usr/local/apache2/bin/apachectl restart 重启

要在重启 Apache 服务器时不中断当前的连接,则应运行:

/usr/local/sbin/apachectl graceful

 

如果apache安装成为linux的服务的话,可以用以下命令操作:

service httpd start 启动

service httpd restart 重新启动

service httpd stop 停止服务

 

 

=======================================================

tomcat 启动与关闭

./bin/startup.sh 启动

 

./bin/shutdown.sh 关闭

kill -9 pid

 

=======================================================

防火墙 开启与关闭

/etc/rc.d/init.d/iptables status 状态

/etc/rc.d/init.d/iptables start 启动

/etc/rc.d/init.d/iptables stop 关闭

 

 

=======================================================

端口查看

netstat -a | grep 80

 

你可能感兴趣的:(linux,数据库,服务器)