Skip to content

Instantly share code, notes, and snippets.



Last active Dec 20, 2015
What would you like to do?
# jdbimp -- Import a sql file into a Joomla database.
# Supports Joomla versions 1.0 - 3.3
# Copyright 2014 Rene Kreijveld -
# This program is free software; you may redistribute it and/or modify it.
# Warning! This script needs the file joomlafunctions. This has to be installed in the same directory as this script.
# General variables
# Determine path of script
MYPATH=$( cd $(dirname $0) ; pwd -P )
# Include general functions
. ${MYPATH}/joomlafunctions
echo "jdbimp verion ${VERSION}, written by René Kreijveld"
echo "This is a Joomla! $versr.$versd site. Starting database import..."
# Check if database dump exists.
if [ ! -e $database.sql ]; then
echo "Database dump $database.sql not found!"
exit 1
# Import the database from a .sql file
if mysql --host=$host --user=$dbuser --password=$password --socket=$MYSOCK $database < $database.sql; then
echo "$database.sql imported."
exit 0
echo "Error importing database dump."
exit 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment