In the next script, we will provide the detail for a database connection along with the SQL query to execute. You will be able to run this if you have a MariaDB or MySQL database server on your system, or one that you can connect to. For this demonstration, we will use Linux Mint 18.3 and MariaDB version 10; however, this should work for any MySQL server or MariaDB, from version 5 onwards. The script collects user and password information as well as the SQL command to execute. Create the following script as $HOME/bin/run_mysql.sh:
#!/bin/bash# Author: @theurbanpenguin# Web: www.theurbapenguin.com# Script to prompt for MYSQL user password and command# Last Edited: July 4 2015read -p "MySQL User: " user_nameread -sp ...