How to check MySQL is installed or not in Ubuntu

In this article, we will check MySQL is installed or not in Ubuntu. We will show the commands to find MySQL is installed on Ubuntu or not

How to check MySQL is installed or not in Ubuntu

Following examples shows when MySQL not installed:

1. We can use the dpkg tool to find the packages installed. Output should be package name and installed. But, below output is install, which MySQL is not installed.

dpkg --get-selections | grep mysql

How to check MySQL is installed or not in Ubuntu

2. Another command to check MySQL is installed or not is.

dpkg -s mysql-server | grep Status

3. We can also try executing ‘mysql’ or mysql — version without quotes on terminal. it will prompt version otherwise Command Not Found. or run below command.

mysqladmin -u root -p status

4. We can also find MySQL is not installed or not using which mysqld. If it is installed, we will get the status. Otherwise, it will give blank output.

Following example show when MySQL is installed.

1. Another command to check MySQL is installed or not is.

dpkg -s mysql-server | grep Status

2. We can also try executing ‘mysql’ or mysql — version without quotes on terminal. it will prompt version otherwise Command Not Found. or run below command.

mysqladmin -u root -p status

It is asking password means MySQL is already installed.

3. We can also find MySQL is not installed or not using which mysqld. If it is installed, we will get the status. Otherwise, it will give blank output.