Check out example codes for "automate mysql cli query". It will help you in understanding the concepts better.

Code Example 1

#!/bin/bash
mysql -u root -psecret <<MY_QUERY
USE mysql
SHOW tables
MY_QUERY

Learn ReactJs, React Native from akashmittal.com