Last active
August 29, 2015 13:56
-
-
Save quickshiftin/8942140 to your computer and use it in GitHub Desktop.
mysqldbs - Show all mysql databases for a given host (defaults to localhost) a given user can view with a simple Bash alias.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
alias mysqldbs='_() { local h=""; if [ ! -z "$2" ]; then h="-h$2"; fi; echo "show databases;" | mysql -u "$1" "$h" -p; }; _' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
To use this simply type
for example to connect as root. You will then be prompted for a password, and after typing the password and hitting enter, you will get a listing of the databases.
You can specify a host other than localhost by providing a second argument