Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #/usr/bin/env sh
- # must match the server name in ~/.ssh/config if the specified settings are to be used
- SOURCE_SSH_SERVER=lutra
- # username for the target mysql
- MYSQL_USER=root
- # password for the target mysql
- MYSQL_PASS=pass
- # hostname of the target mysql
- MYSQL_HOST=127.0.0.1
- if [ $# != 3 ]; then
- echo "
- This script is used to get a mysql database dump from a remote server and send it to another myslq instance.
- USAGE
- It takes three arguments:
- dbname The name of the source db
- username The username to access the source db
- password The password to access the source db
- EXAMPLE
- sh mysqlDbImporter.sh dbname username password
- "
- exit 0
- fi
- ssh $SOURCE_SSH_SERVER mysqldump \
- --databases \
- --add-drop-database \
- -u $2\
- -p$3 \
- $1 | mysql -u $MYSQL_USER -p$MYSQL_PASS -h $MYSQL_HOST
- echo "Database $1 has been imported."
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement