How can I check if mysql is installed on ubuntu?
"mysql" may be found even if mysql and mariadb is uninstalled, but not "mysqld".
Faster than rpm -qa | grep mysqld is:
which mysqld
You can use tool dpkg for managing packages in Debian operating system.
Example
dpkg --get-selections | grep mysql
if it's listed as installed, you got it. Else you need to get it.