-->
🏠 🔍
SHAREOLITE

Beginners linux shell script to view MySQL status

Usually when you install MySQL software using RPMs - the server processes can  be stopped using linux services as below

service mysqld status

However in few instances where if you have installed MySQL using source packages like .tar or .bz files - you may have to use manual commands to view the status of mysql process. Below mentioned is one such beginners linux script to view the status of a MySQL server.

Copy the code below highlighted in blue , save it in a file and execute for output. There are 2 variables DBUSER,DBPASS,DBHOST which have to be configured based on your installation.

########################################################################
# Configure the DB user name here.
# Ex. DBUSER="employee"
########################################################################
DBUSER="employee"

########################################################################
# Configure the DB user password here.
# Ex. DBPASS="test"
#################################################################################
DBPASS="m@gictest"

########################################################################
# Connfigure the hostname here.
# Ex. DBHOST="10.10.23.114" . For localhost enter 127.0.0.1
########################################################################
DBHOST="10.3.2.1"

########################################################################

mysql -u $DBUSER -p$DBUSER -h $DBHOST << EOF

\s;

EOF

########################################################################

Hope this is useful to some Linux beginners

Comments

–>