Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- host="127.0.0.1"
- db="dynmap"
- user="db_user_name"
- pass="db_user_pass"
- ## an alternative to putting the password into the script ( "less secure" ) is to read the user input into the variable ( "more secure" ).
- #echo "Enter password for $user: "
- #read -s pass
- #database sizes
- 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'";');
- echo $dbsize;
Add Comment
Please, Sign In to add comment