Mian Anjum
Mian Anjum

Reputation: 379

How to find out the mysql service on linux server

How to find out the mysql service on linux server.

I have tried it .

[root@anjum/]# service mysqld status
mysqld: unrecognized service

[root@anjum/]# service mysql status
mysql: unrecognized service
 service mysql status
mysql: unrecognized service 

Upvotes: 6

Views: 28906

Answers (3)

Alfa Bravo
Alfa Bravo

Reputation: 1991

Just remember if you are using MySQL via a docker container (say maybe MySQL:8.0) then in many of the images you will not have the service management utilities to do this.

service mysqld status or service mysql status will give you unrecognized service even though the service is running fine and you can log into the MySQL prompt using mysql -uroot -p and start executing queries without any problems.

This has to do with the way that the docker container was set up, to keep the container as small as possible. If for some reason you want to restart mysql, then the standard way would be to restart the container.

Upvotes: 3

Chaminda Bandara
Chaminda Bandara

Reputation: 2170

This looks like MySQL has not been installed there.

Check that:

rpm -qa | grep mysql

returns something like

mysql-server-5.0.77-4.el5_6.6
mysql-5.0.77-4.el5_6.6

Upvotes: 0

Zafar Malik
Zafar Malik

Reputation: 6854

First make sure that mysql is installed on your server by below steps-

Step1:

cat /etc/my.cnf 

get data directory from here suppose it is /var/lib/mysql

Step2: check if all related mysql files are there-

ls -lh /var/lib/mysql

You can also check by below command:

ls /etc/init.d | grep mysql

If everything is ok and still showing unrecognized. Then you have to check if same ip alloted to some other server.

Upvotes: 2

Related Questions