Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to find out the mysql service on linux server

Tags:

linux

mysql

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 
like image 924
Mian Anjum Avatar asked Sep 28 '22 01:09

Mian Anjum


2 Answers

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.

like image 95
Alfa Bravo Avatar answered Oct 03 '22 03:10

Alfa Bravo


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.

like image 31
Zafar Malik Avatar answered Oct 03 '22 01:10

Zafar Malik