Created
January 17, 2013 20:05
-
-
Save xero/4559231 to your computer and use it in GitHub Desktop.
this shell script will take an .sql backup file and install it to a given database. it will prompt you for username, password, database, and sql file. i set my default file location to ~/Downloads/ because that's where i always have my backups. edit as necessary.
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
#!/bin/sh | |
echo -e "\e[01;33m[username]\e[00m" | |
read user | |
echo -e "\e[01;33m[password]\e[00m" | |
read pass | |
echo -e "\e[01;33m[database]\e[00m" | |
read db | |
echo -e "\e[01;33m[sql file]\e[00m" | |
read file | |
mysql> mysql -u $user -p $pass $db < ~/Downloads/$file |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment