You may encounter a situation when you’re not sure if MySQL or MariaDB is installed and running on your Linux machine.
Maybe you’ve just finished installing MySQL/MariaDB and you want to make sure everything’s working properly.
Or you are on a new server, and you don’t know what software is installed on it.
You can use one of the following commands to find out if MySQL/MariaDB is installed and running.
sudo mysql

sudo mysql --version

sudo service mysql status

sudo /etc/init.d/mysql status

Based on the response, you can tell if MySQL/MariaDB is installed and running or not.