I have a MySQL server with an user with a password. I want to execute some SQL queries in shell scripts without specifying the password like this:
config.sh:
MYSQL_ROOT="root"
MYSQL_PASS="password"
mysql.sh:
source config.sh
mysql -u$MYSQL_ROOT -p$MYSQL_PASS -e "SHOW DATABASES"
How can I simplify the whole process in order to execute SQL queries without specifying the -p and -u argument etc.?
Try this: