Created
June 15, 2015 19:04
-
-
Save Sjeanpierre/62efa0c2701aa4d55438 to your computer and use it in GitHub Desktop.
Connect to database defined by rails databae.yml when on a server
This file contains hidden or 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
#! /usr/bin/env bash | |
USERNAME=`cat config/database.yml | grep username | awk {'print$2'}` | |
PASSWORD=`cat config/database.yml | grep password | awk {'print$2'}` | |
HOST=`cat config/database.yml | grep host | awk {'print$2'}` | |
DATABASE=`cat config/database.yml | grep database | awk {'print$2'}` | |
mysql -h $HOST -u $USERNAME -D $DATABASE -p$PASSWORD |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment