add sql files to create and remove the database

This commit is contained in:
Andreas Zweili 2017-11-04 08:36:39 +01:00
parent bd2ddf1260
commit 9bf2f2282b
3 changed files with 26 additions and 5 deletions

9
Vagrantfile vendored
View File

@ -28,13 +28,12 @@ Vagrant.configure("2") do |config|
#zu installierende Pakete
apt-get install -y apache2 python3-django mariadb-server avahi-daemon \
libnss-mdns libapache2-mod-wsgi-py3 python3-mysqldb
libnss-mdns libapache2-mod-wsgi-py3 python3-mysqldb
#So würde der Code aussehen um SQL Scripts in die DB zu importieren.
#mysql < /vagrant/sql/remove_db.sql
#mysql < /vagrant/sql/create_db.sql
#mysql < /vagrant/sql/add_data.sql
#initialize the db
mysql < /vagrant/sql/04_remove_database.sql
mysql < /vagrant/sql/01_create_database.sql
#löschen und verlinken der HTML root damit man diese nicht manuel kopieren muss.
if ! [ -L /var/www/html ]; then

View File

@ -0,0 +1,14 @@
-- Creates the webshop DB
--
-- Author: Andreas Zweili
-- 2017-11-04
-- MariaDB 10.1.26
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
create database if not exists webshopdb;
grant all on webshopdb.* to
'webshop'@'localhost'
identified by '2YKtY53F3HDDzPyExAaSh3jdVNh6VN';
flush privileges;

View File

@ -0,0 +1,8 @@
-- Removes the webshop DB
--
-- Author: Andreas Zweili
-- 2017-11-04
-- MariaDB 10.1.26
drop database if exists webshopdb;
drop user if exists webshop@localhost;