Your script will fail if
mysql is not in the script PATH.
Note: This is only one way to do this. There are other examples that may be more efficient or more to your liking. One of the strengths of this site is the differing opinions and approaches to achieve the same result.
for file in $(find / -executable -type f -name mysql -print 2>/dev/null)
echo "Found $file"
This will return
/usr/bin/mysql Ver 14.14 Distrib 5.5.23, for Linux (x86_64) using readline 5.1
Note that if you have a large filesystem and a lot of files, this may take a long time.
Realize that as per your request, this will see if the
mysql client is installed, not the
mysqld server. It's possible to install the client without the server. If you want to see if
mysqld is installed, modify the
find and remove the version test.