Checking the version of MySQL database

We will initially start by checking which version of MySQL is installed. With this script, we will ensure that MySQL is properly installed and we are able to communicate with it with root privileges. This script will report us the database version of MySQL. It executes a SELECT VERSION() query to get the value of the database version. Let's create the script

mysql -u root -pTraining2@^ <<MY_QUERY 

Save the program and execute it as follows:

    $ chmod +x
    $ ./

The output will be:


Get Learning Linux Shell Scripting - Second Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.