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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.