Start and turn off MYSQ services under Linux platform __linux

Source: Internet
Author: User


Under the Linux platform, you can view the status of the MySQL service with the following command:

[Root@localhost ~]# NETSTAT-NLP
Active Internet connections (only servers)
Proto recv-q Send-q Local address Foreign address State Pid/program Name
TCP 0 0 127.0.0.1:2208 0.0.0.0:* LISTEN 2182/./hpiod
TCP 0 0 0.0.0.0:5989 0.0.0.0:* LISTEN 2611/cimservermain
TCP 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 2369/mysqld
TCP 0 0 0.0.0.0:111 0.0.0.0:* LISTEN 1833/portmap
TCP 0 0 0.0.0.0:784 0.0.0.0:* LISTEN 1874/rpc.statd

...

[Root@localhost ~]#


Where port number 3306 is the MySQL server listening port;


There are two ways to start and shut down MySQL

1) Imperative mode

Root@localhost sbin]# cd/usr/bin/
[Root@localhost bin]#./mysqld_safe &

[1] 12788
[Root@localhost bin]# 150507 01:25:46 mysqld_safe Logging to '/var/lib/mysql/localhost.localdomain.err '.
150507 01:25:47 Mysqld_safe starting mysqld daemon with databases From/var/lib/mysql



[Root@localhost bin]# mysqladmin-u root-p shutdown
Enter Password:
150507 01:26:48 mysqld_safe mysqld from PID File/var/lib/mysql/localhost.localdomain.pid ended
[1]+ done./mysqld_safe
[Root@localhost bin]#


2) The way of service

[root@localhost bin]# service MySQL start
Starting MySQL. [OK]
[root@localhost bin]# service MySQL restart
Shutting down MySQL. [OK]
Starting MySQL. [OK]
[root@localhost bin]# service MySQL Stop
Shutting down MySQL. [OK]
[Root@localhost bin]#



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.