Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- ###################################################
- #Author: Kieran Canavan #
- #Date: 18/01/2018 #
- #Purpose: Script to connect to a remote mysql #
- #instance and run a command using HERE document #
- ###################################################
- ##Note: Storing password in plaintext script is bad practice. This works only as a quick and dirty test script
- ##Variables
- host=<hostname>;
- db=<dbname>;
- user=<dbuser>;
- pass=<dbpass>;
- echo "Showing database tables..."
- mysql --host=$host --user=$user --password=$pass $db<<EOFMYSQL
- SHOW tables
- EOFMYSQL
- echo "Done!";
Add Comment
Please, Sign In to add comment