Eine Einführung - Teil 14
Deutsche Angestellten Akademie
~$ sudo apt install apache2 mysql-server phpmyadmin~$ mysql -u root -p
MariaDB [(none)]> CREATE USER 'newuser'@'localhost' IDENTIFIED BY 'some_very_complex_password';
MariaDB [(none)]> GRANT ALL PRIVILEGES ON * . * TO 'newuser'@'localhost'; FLUSH PRIVILEGES;
MariaDB [(none)]> \q
Relationale Datenbanken versuchen, die Realität in einem Datenmodell abzubilden.
 
					Quelle: http://www.datenbanken-verstehen.de/datenbank-grundlagen/datenbankmodell/relationales-datenbankmodell/
| Rg Nr | Datum | Name | Straße | Ort | Artikel | Anzahl | Preis | 
| 143 | 01.04.2018 | Max Müller | Trumstrasse 4 | 75179 Pforzheim | Bleistift | 1001 | 1,00€ | 
| Rg Nr | Datum | Vor Name | Nach Name | Straße | Hausnr | PLZ | Ort | Artikel | Anzahl | Preis | 
| 143 | 01.04.2018 | Max | Müller | Trumstrasse | 4 | 75179 | Pforzheim | Bleistift | 1001 | 1,00€ | 
| Rg Nr | Datum | Vor Name | Nach Name | Straße | Hausnr | PLZ | Ort | Artikel | Anzahl | Preis | 
| 144 | 01.04.2018 | Max | Müller | Trumstrasse | 4 | 75179 | Pforzheim | Bleistift | 1001 | 1,00€ | 
| 145 | 01.04.2018 | Max | Müller | Trumstrasse | 4 | 75179 | Pforzheim | Tüte | 1001 | 0,10€ | 
| 146 | 01.04.2018 | Max | Müller | Trumstrasse | 4 | 75179 | Pforzheim | Ratzefummel | 1001 | 1,50€ | 
| ID | Vor Name | Nach Name | Straße | Hausnr | PLZ | Ort | 
| 1234 | Max | Müller | Trumstrasse | 4 | 75179 | Pforzheim | 
| Rg Nr | Datum | KundenID | Artikel | Anzahl | Preis | 
| 144 | 01.04.2018 | 1234 | Bleistift | 1001 | 1,00 | 
| 145 | 01.04.2018 | 1234 | Tüte | 12 | 0,10 | 
| 146 | 01.04.2018 | 1234 | Ratzefummel | 32 | 1,50 | 
~$ sudo mysql
# oder:
~$ mysql -u BENUTZERNAME -p -h localhost
					CREATE DATABASE IF NOT EXISTS test;
USE test;
CREATE TABLE IF NOT EXISTS books (
  BookID INT NOT NULL PRIMARY KEY AUTO_INCREMENT, 
  Title VARCHAR(100) NOT NULL, 
  SeriesID INT, AuthorID INT);
CREATE TABLE IF NOT EXISTS authors 
(id INT NOT NULL PRIMARY KEY AUTO_INCREMENT);
CREATE TABLE IF NOT EXISTS series 
(id INT NOT NULL PRIMARY KEY AUTO_INCREMENT);
INSERT INTO books (Title,SeriesID,AuthorID) 
VALUES('The Fellowship of the Ring',1,1), 
      ('The Two Towers',1,1), ('The Return of the King',1,1),  
      ('The Sum of All Men',2,2), ('Brotherhood of the Wolf',2,2), 
      ('Wizardborn',2,2), ('The Hobbbit',0,1);
SHOW TABLES;
+----------------+
| Tables_in_test |
+----------------+
| authors        |
| books          |
| series         |
+----------------+
3 rows in set (0.00 sec)
					DESCRIBE books;
+----------+--------------+------+-----+---------+----------------+
| Field    | Type         | Null | Key | Default | Extra          |
+----------+--------------+------+-----+---------+----------------+
| BookID   | int(11)      | NO   | PRI | NULL    | auto_increment |
| Title    | varchar(100) | NO   |     | NULL    |                |
| SeriesID | int(11)      | YES  |     | NULL    |                |
| AuthorID | int(11)      | YES  |     | NULL    |                |
+----------+--------------+------+-----+---------+----------------+
					SELECT * FROM books;
+--------+----------------------------+----------+----------+
| BookID | Title                      | SeriesID | AuthorID |
+--------+----------------------------+----------+----------+
|      1 | The Fellowship of the Ring |        1 |        1 |
|      2 | The Two Towers             |        1 |        1 |
|      3 | The Return of the King     |        1 |        1 |
|      4 | The Sum of All Men         |        2 |        2 |
|      5 | Brotherhood of the Wolf    |        2 |        2 |
|      6 | Wizardborn                 |        2 |        2 |
|      7 | The Hobbbit                |        0 |        1 |
+--------+----------------------------+----------+----------+
7 rows in set (0.00 sec)INSERT INTO books (Title, SeriesID, AuthorID)
VALUES ("Lair of Bones", 2, 2);
Query OK, 1 row affected (0.00 sec)SELECT * FROM books;UPDATE books 
SET Title = "The Hobbit" 
WHERE BookID = 7;
Query OK, 1 row affected (0.00 sec)
Rows matched: 1  Changed: 1  Warnings: 0/var/lib/mysql/etc/mysql/my.cnfindex.html ausgeliefertsystemctl start | stop | restart | reload | force-reload apache2 /etc/apache2/apache2.conf/etc/apache2/conf-available//etc/apache2/sites-available/.htaccess~$ sudo a2enconf NAME_DER_DATEI.conf 
~$ sudo a2disconf NAME_DER_DATEI.conf ~$ sudo a2ensite MEINE_WEBSEITE.conf 
~$ sudo a2dissite MEINE_WEBSEITE.conf  /etc/apache/[ conf | site ]-enabled
					Nach Änderungen in diesen Dateien:
~$ sudo systemctl reload apache2Beispiel:: beispiele/15/schubertdaniel.conf
Erstellt eine Webseite namens omikron, die per
http://localhost/omikron 
aus dem Ordner 
/var/www/html/omikron 
ausgeliefert wird.
				
Verlegt die Wordpress Installation nach /home/NUTZERNAME/www/wordpress