Thursday, November 3, 2016

how to check if mysql server is running or not in linux ?


Method 1:

root@linuxforfreshers.com:~$ service mysql status
Or
root@linuxforfreshers.com:~$ /etc/init.d/mysql status
mysql start/running, process 13749

Method 2:
root@linuxforfreshers.com:~$ps aux | grep mysql
mysql    13749  0.2  1.3 492660 52336 ?        Ssl  13:05   0:38 /usr/sbin/mysqld

Method 3:
root@linuxforfreshers.com:~$netstat -vulntp |grep -i mysql
tcp        0      0 127.0.0.1:3306          0.0.0.0:*               LISTEN      13749/mysqld    
Method 4:
root@linuxforfreshers.com:~$lsof -i :3306
COMMAND   PID  USER   FD   TYPE  DEVICE SIZE/OFF NODE NAME
mysqld  13749 mysql   10u  IPv4 5037327      0t0  TCP localhost:mysql (LISTEN)

Method 5:
root@linuxforfreshers.com:~$mysqladmin ping

mysqld is alive

No comments:

Post a Comment