Guest User

Untitled

a guest
Feb 7th, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. #!/bin/bash
  2. host="127.0.0.1"
  3. db="dynmap"
  4. user="db_user_name"
  5. pass="db_user_pass"
  6. ## an alternative to putting the password into the script ( "less secure" ) is to read the user input into the variable ( "more secure" ).
  7. #echo "Enter password for $user: "
  8. #read -s pass
  9.  
  10. #database sizes
  11. dbsize=$(mysql -u $user -h $host -p$pass -se 'SELECT table_schema "DB Name", Round(Sum(data_length + index_length) / 1024 / 1024, 1) "DB Size in MB" FROM information_schema.tables WHERE table_schema = "'$db'";');
  12. echo $dbsize;
Add Comment
Please, Sign In to add comment