Push Dump File Contents to Remote DB

Last modified: 
Tuesday, October 13th, 2015
Topics: 
MySQL

This is a script demonstrating no-frills method to push a dumpfile to a remote mysql database.

#! /bin/bash
#
# @file pushdb.sh
#
# Usage: ./pushdb.sh path/to/dumpfile.sql
# 
DBHOST='DBHOST'
DBNAME='DBNAME'
DBUSER='DBUSER'
DBPASS='DBPASS'
if [[ $1 ]];then
  time  mysql -h "$DBHOST" -u "$DBUSER" -p"$DBPASS"  "$DBNAME" < $1
else
  echo "Requires path to sql file."
fi


The operator of this site makes no claims, promises, or guarantees of the accuracy, completeness, originality, uniqueness, or even general adequacy of the contents herein and expressly disclaims liability for errors and omissions in the contents of this website.