Show databases

To see all of the databases, we are going to use the command show databases. Create the script mysql_03.sh to see all of the databases:

#!/bin/bash 
mysql -u root -pTraining2@^ <<MY_QUERY 
show databases; 
MY_QUERY 

Save the script and run it as follows:

          $ chmod +x mysql_03.sh
          $ ./mysql_03.sh
  

The output will be:

    Database information_schema mysql performance_schema sys testdb
  

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.