#7-DataBase Server

Pengertian Database Server

  • Database Server adalah server yang digunakan untuk menyimpan, mengelola, dan menyediakan akses ke data dalam bentuk terstruktur.
  • Database server memungkinkan banyak pengguna atau aplikasi untuk membaca, menulis, dan memodifikasi data secara bersamaan melalui jaringan.

🔎 Contoh nyata:

  • Sistem e-rapor di sekolah → menyimpan data siswa, nilai, guru, dan mata pelajaran.
  • Aplikasi e-commerce → menyimpan data produk, pembeli, dan transaksi.

Fungsi Database Server

  • Penyimpanan Data Terpusat → semua data disimpan di satu server.
  • Akses Bersama → banyak client/aplikasi bisa menggunakan data secara bersamaan.
  • Keamanan Data → data dapat dilindungi dengan sistem user dan password.
  • Pengelolaan Data → mendukung query (SQL) untuk mencari, menambah, mengubah, dan menghapus data.
  • Integrasi dengan Aplikasi → web server atau aplikasi desktop/mobile dapat terhubung ke database.

Jenis Database Server

  1. Relational Database (RDBMS)
    • Data disimpan dalam tabel (rows & columns).
    • Contoh: MySQL, MariaDB, PostgreSQL, Oracle, Microsoft SQL Server.
  1. NoSQL Database
    • Data tidak berbentuk tabel, biasanya dalam bentuk dokumen, key-value, graph.
    • Contoh: MongoDB, Redis, Cassandra.

Komponen Database Server

  • Hardware: server dengan CPU, RAM, dan storage cukup besar.
  • Software Database: MySQL, MariaDB, PostgreSQL, MongoDB.
  • Client: aplikasi yang mengakses database, bisa berupa aplikasi web, desktop, atau mobile.

Konsep Dasar Database

  • Database: wadah penyimpanan data.
  • Table: struktur data di dalam database (berisi baris dan kolom).
  • Field/Column: atribut data (misalnya: nama, alamat, nilai).
  • Record/Row: isi data (misalnya: “Budi, XI TKJ 1, 85”).
  • Primary Key: kunci unik untuk membedakan tiap record.
  • Query: perintah SQL untuk mengolah data.

Langkah 1 – PHP

Login sebagai user root dan lakukan update terlebih dahulu.

root@ns100:~# apt update
Get:1 https://security.debian.org/debian-security bookworm-security InRelease [48.0 kB]
Hit:2 https://deb.debian.org/debian bookworm InRelease
Get:3 https://deb.debian.org/debian bookworm-updates InRelease [55.4 kB]
Get:4 https://security.debian.org/debian-security bookworm-security/main Sources [150 kB]
Get:5 https://security.debian.org/debian-security bookworm-security/main amd64 Packages [277 kB]
Get:6 https://security.debian.org/debian-security bookworm-security/main Translation-en [167 kB]
Fetched 697 kB in 1s (601 kB/s)
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
44 packages can be upgraded. Run 'apt list --upgradable' to see them.
root@ns100:~#

Install PHP di server

root@ns100:~# apt install php libapache2-mod-php php-cli php-fpm php-json php-pdo php-mysql php-zip php-gd php-mbstring php-curl php-xml php-pear php-bcmath
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Note, selecting 'php8.2-common' instead of 'php-pdo'
The following additional packages will be installed:
  fontconfig-config fonts-dejavu-core libabsl20220623 libaom3 libapache2-mod-php8.2 libavif15 libdav1d6
  libde265-0 libdeflate0 libfontconfig1 libgav1-1 libgd3 libheif1 libjbig0 libjpeg62-turbo liblerc4
  libnuma1 libonig5 librav1e0 libsodium23 libsvtav1enc1 libtiff6 libwebp7 libx265-199 libxpm4 libxslt1.1
  libyuv0 libzip4 php-common php8.2 php8.2-bcmath php8.2-cli php8.2-curl php8.2-fpm php8.2-gd
  php8.2-mbstring php8.2-mysql php8.2-opcache php8.2-readline php8.2-xml php8.2-zip psmisc
Suggested packages:
  libgd-tools
The following NEW packages will be installed:
  fontconfig-config fonts-dejavu-core libabsl20220623 libaom3 libapache2-mod-php libapache2-mod-php8.2
  libavif15 libdav1d6 libde265-0 libdeflate0 libfontconfig1 libgav1-1 libgd3 libheif1 libjbig0
  libjpeg62-turbo liblerc4 libnuma1 libonig5 librav1e0 libsodium23 libsvtav1enc1 libtiff6 libwebp7
  libx265-199 libxpm4 libxslt1.1 libyuv0 libzip4 php php-bcmath php-cli php-common php-curl php-fpm
  php-gd php-json php-mbstring php-mysql php-pear php-xml php-zip php8.2 php8.2-bcmath php8.2-cli
  php8.2-common php8.2-curl php8.2-fpm php8.2-gd php8.2-mbstring php8.2-mysql php8.2-opcache
  php8.2-readline php8.2-xml php8.2-zip psmisc
0 upgraded, 56 newly installed, 0 to remove and 44 not upgraded.
Need to get 19.1 MB of archives.
After this operation, 80.7 MB of additional disk space will be used.
Do you want to continue? [Y/n] y

Setting up php8.2-gd (8.2.29-1~deb12u1) ...

Creating config file /etc/php/8.2/mods-available/gd.ini with new version
Setting up php-gd (2:8.2+93) ...
Setting up php (2:8.2+93) ...
Processing triggers for libc-bin (2.36-9+deb12u10) ...
Processing triggers for php8.2-cli (8.2.29-1~deb12u1) ...
Processing triggers for php8.2-fpm (8.2.29-1~deb12u1) ...
NOTICE: Not enabling PHP 8.2 FPM by default.
NOTICE: To enable PHP 8.2 FPM in Apache2 do:
NOTICE: a2enmod proxy_fcgi setenvif
NOTICE: a2enconf php8.2-fpm
NOTICE: You are seeing this message because you have apache2 package installed.
Processing triggers for libapache2-mod-php8.2 (8.2.29-1~deb12u1) ...

Langkah 2 – Install Database (Mariadb) dan phpMyAdmin

root@ns100:~# apt install mariadb-server phpmyadmin
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
  dbconfig-common dbconfig-mysql galera-4 gawk icc-profiles-free javascript-common libcgi-fast-perl
  libcgi-pm-perl libclone-perl libconfig-inifiles-perl libdbd-mariadb-perl libdbi-perl
  libencode-locale-perl libfcgi-bin libfcgi-perl libfcgi0ldbl libhtml-parser-perl libhtml-tagset-perl
  libhtml-template-perl libhttp-date-perl libhttp-message-perl libio-html-perl libjs-codemirror
  libjs-jquery libjs-jquery-metadata libjs-jquery-mousewheel libjs-jquery-tablesorter
  php-symfony-expression-language php-symfony-filesystem php-symfony-polyfill-php80
  php-symfony-service-contracts php-symfony-var-exporter php-tcpdf php-twig php-twig-i18n-extension
  php-webmozart-assert php8.2-bz2 php8.2-mcrypt phpmyadmin pv rsync socat
0 upgraded, 91 newly installed, 0 to remove and 44 not upgraded.
Need to get 37.2 MB of archives.
After this operation, 276 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Processing triggers for libapache2-mod-php8.2 (8.2.29-1~deb12u1) ...
Processing triggers for libc-bin (2.36-9+deb12u10) ...
Processing triggers for php8.2-fpm (8.2.29-1~deb12u1) ...
NOTICE: Not enabling PHP 8.2 FPM by default.
NOTICE: To enable PHP 8.2 FPM in Apache2 do:
NOTICE: a2enmod proxy_fcgi setenvif
NOTICE: a2enconf php8.2-fpm
NOTICE: You are seeing this message because you have apache2 package installed.
Processing triggers for php8.2-cli (8.2.29-1~deb12u1) ...
Processing triggers for mariadb-server (1:10.11.11-0+deb12u1) ...
root@ns100:~#

Untuk menguji apakah PHP berfungsi dengan baik, kita akan membuat sebuah file yang berisi semua informasi tentang PHP yang tersedia. Jalankan perintah di bawah ini:

root@ns100:~# echo "<?php phpinfo(); ?>" > /var/www/html/info.php
root@ns100:~# /etc/init.d/apache2 restart

Langkah 3 – Agar user root dapat diakses melalui panel phpMyAdmin

Untuk mengakses Database melalui panel phpMyAdmin lakukan langkah-langkah berikut ini:

root@ns100:~# mysql -u root -p
Enter password: 12345
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 42
Server version: 10.11.11-MariaDB-0+deb12u1 Debian 12

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> SELECT user,authentication_string,plugin,host FROM mysql.user;
+-------------+-------------------------------------------+-----------------------+-----------+
| User        | authentication_string                     | plugin                | Host      |
+-------------+-------------------------------------------+-----------------------+-----------+
| mariadb.sys |                                           | mysql_native_password | localhost |
| root        | invalid                                   | mysql_native_password | localhost |
| mysql       | invalid                                   | mysql_native_password | localhost |
| phpmyadmin  | *00A51F3F48415C7D4E8908980D443C29C69B60C9 | mysql_native_password | localhost |
+-------------+-------------------------------------------+-----------------------+-----------+
4 rows in set (0.003 sec)

MariaDB [(none)]> ALTER USER root@localhost IDENTIFIED VIA mysql_native_password;
Query OK, 0 rows affected (0.001 sec)

MariaDB [(none)]> SET PASSWORD = PASSWORD('P4ssword');
Query OK, 0 rows affected (0.001 sec)

MariaDB [(none)]> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.001 sec)

MariaDB [(none)]> SELECT user,authentication_string,plugin,host FROM mysql.user;
+-------------+-------------------------------------------+-----------------------+-----------+
| User        | authentication_string                     | plugin                | Host      |
+-------------+-------------------------------------------+-----------------------+-----------+
| mariadb.sys |                                           | mysql_native_password | localhost |
| root        | *300C242CC1A0113E0209F80215BEDD5E07A56556 | mysql_native_password | localhost |
| mysql       | invalid                                   | mysql_native_password | localhost |
| phpmyadmin  | *00A51F3F48415C7D4E8908980D443C29C69B60C9 | mysql_native_password | localhost |
+-------------+-------------------------------------------+-----------------------+-----------+
4 rows in set (0.001 sec)

MariaDB [(none)]> exit
Bye
root@ns100:~#

Untuk melihat info PHP di browser, ketik url http://IP_address_server/info.php

Pengujian akses ke database melalui interface phpMyAdmin melalui url http://sekolah100.sch.id/phpmyadmin

  1. Akses alamat url http://sekolah100.sch.id/phpmyadmin
  2. Username : root
  3. Password : P4ssword
  4. Klik tombol Log in

Halaman Dashboard phpMyAdmin

Membuat user account sekaligus database nya. 

  1. Klik menu User account
  2. Klik Add user account
  1. Ketik user – hyd
  2. Pilih local – localhost
  3. Ketik password123
  4. Ulangi ketik password123
  5. Centang Create
  6. Centang Grant
  7. Centang Check all
  8. Klik tombol GO

User dan databse hyd terbentuk

Login menggunakan user hyd

Kantor

Jl. dr. Wahidin Sudiro Husodo No.22,
Klaten Utara, Klaten 57432,
Jawa Tengah, INDONESIA.
Telp. 0272-321266

Terbaru

Galeri

Copyright © 2025  – TJKT SMK NEGERI 1 KLATEN – HYD