Skip to content

Instantly share code, notes, and snippets.

@mattische
Last active January 12, 2017 14:11
Show Gist options
  • Select an option

  • Save mattische/2ae6053bab69ee8a174374e14cfbf221 to your computer and use it in GitHub Desktop.

Select an option

Save mattische/2ae6053bab69ee8a174374e14cfbf221 to your computer and use it in GitHub Desktop.
# Change these to suit your needs...
DBHOST=localhost
DBNAME=dbname
DBUSER=dbuser
DBPASSWD=test123
DB_ROOT_PASS=password123
apt-get -y install curl build-essential python-software-properties git python3
debconf-set-selections <<< "mysql-server mysql-server/root_password password $DB_ROOT_PASS"
debconf-set-selections <<< "mysql-server mysql-server/root_password_again password $DB_ROOT_PASS"
apt-get -y install mysql-server
mysql -uroot -p$DB_ROOT_PASS -e "CREATE DATABASE $DBNAME"
mysql -uroot -p$DB_ROOT_PASS -e "grant all privileges on $DBNAME.* to '$DBUSER'@'$DBHOST' identified by '$DBPASSWD'"
# REMOVE IF YOU DO NOT WANT THE EXAMPLE DATABASES
# example database 1
apt-get -y install unzip
wget http://downloads.mysql.com/docs/world.sql.zip
unzip world.sql.zip
mysql -uroot -p$DB_ROOT_PASS -e "SOURCE ~/world.sql"
# example database 2
wget https://raw.githubusercontent.com/dite-bth/ME1579-VT17/master/excercises/database/classic.sql
mysql -uroot -p$DB_ROOT_PASS -e "SOURCE ~/classic.sql"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment