Guest User

Untitled

a guest
Jan 30th, 2018
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. #!/bin/bash
  2. ###################################################
  3. #Author: Kieran Canavan #
  4. #Date: 18/01/2018 #
  5. #Purpose: Script to connect to a remote mysql #
  6. #instance and run a command using HERE document #
  7. ###################################################
  8.  
  9. ##Note: Storing password in plaintext script is bad practice. This works only as a quick and dirty test script
  10.  
  11. ##Variables
  12. host=<hostname>;
  13. db=<dbname>;
  14. user=<dbuser>;
  15. pass=<dbpass>;
  16.  
  17. echo "Showing database tables..."
  18. mysql --host=$host --user=$user --password=$pass $db<<EOFMYSQL
  19. SHOW tables
  20.  
  21. EOFMYSQL
  22. echo "Done!";
Add Comment
Please, Sign In to add comment