Tahukan Anda tentang apa itu Database ?

Lalu buat apa sih fungsinya ?

Oke jika Anda penasang tentang pengertian fungsi database, berikut ini merupakan pengertian dan fungsi dari database .

Database Server merupakan sebuah program komputer yang menyediakan layanan pengolahan berbasis data dan melayani komputer atau program aplikasi basis data yang menggunakan model client – server.

Fungsi Database Server :

  • Untuk menyimpan beberapa data yang bisa dilakukan dalam 1 lokasi
  • Penyimpanan yang aman karena fasilitas yang di server tidak ada di komputer biasa
  • Manajemen sistem
  • Mempermudah dan mecari dalam lingkup database

Setiap client dapat mengakses secara bersamaan

Database server sendiri bisa dibilang cukup banyak, yang biasanya sering digunakan yaitu MySQL, MariaDB dan PostgreSQL dan yang lainnya.

Nah pada tutorial kali ini saya akan share bagaimana cara instalasi dan konfigurasi database MariaDB di CentOS 7.

Pertama, silakan akses server Anda.

Kedua, jalankan baris perintah berikut

[[email protected] ~]# yum install mariadb-server mariadb-client -y

Silakan tunggu proses instalasi sampai selesai jika sudah, selanjutnya Anda silakan start dan enable lalu melihat status dari database MariaDB telah berjalan dengan normal atau running. Fungsi enable sendiri berfunsi untuk menjalankan service secara otomatis apabila nantinya server dilakukan reboot atau restart, berikut perintah yang digunakan

[[email protected] ~]# 
[[email protected] ~]# systemctl start mariadb
[[email protected] ~]# systemctl status mariadb
● mariadb.service - MariaDB database server
   Loaded: loaded (/usr/lib/systemd/system/mariadb.service; disabled; vendor preset: disabled)
   Active: active (running) since Rab 2019-02-06 19:00:45 WIB; 14s ago
  Process: 1473 ExecStartPost=/usr/libexec/mariadb-wait-ready $MAINPID (code=exited, status=0/SUCCESS)
  Process: 1394 ExecStartPre=/usr/libexec/mariadb-prepare-db-dir %n (code=exited, status=0/SUCCESS)
 Main PID: 1472 (mysqld_safe)
   CGroup: /system.slice/mariadb.service
           ├─1472 /bin/sh /usr/bin/mysqld_safe --basedir=/usr
           └─1634 /usr/libexec/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin --log-error=/var/log/maria...

Peb 06 19:00:43 srv-hamim01.localhost mariadb-prepare-db-dir[1394]: MySQL manual for more instructions.
Peb 06 19:00:43 srv-hamim01.localhost mariadb-prepare-db-dir[1394]: Please report any problems at http://mariadb.org/jira
Peb 06 19:00:43 srv-hamim01.localhost mariadb-prepare-db-dir[1394]: The latest information about MariaDB is available at http://mariadb.org/.
Peb 06 19:00:43 srv-hamim01.localhost mariadb-prepare-db-dir[1394]: You can find additional information about the MySQL part at:
Peb 06 19:00:43 srv-hamim01.localhost mariadb-prepare-db-dir[1394]: http://dev.mysql.com
Peb 06 19:00:43 srv-hamim01.localhost mariadb-prepare-db-dir[1394]: Consider joining MariaDB's strong and vibrant community:
Peb 06 19:00:43 srv-hamim01.localhost mariadb-prepare-db-dir[1394]: https://mariadb.org/get-involved/
Peb 06 19:00:43 srv-hamim01.localhost mysqld_safe[1472]: 190206 19:00:43 mysqld_safe Logging to '/var/log/mariadb/mariadb.log'.
Peb 06 19:00:43 srv-hamim01.localhost mysqld_safe[1472]: 190206 19:00:43 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
Peb 06 19:00:45 srv-hamim01.localhost systemd[1]: Started MariaDB database server.
[[email protected] ~]# 

Berikutnya, melakukan konfigurasi datatabase MariaDB, berikut perintahnya

[[email protected] ~]# 
[[email protected] ~]# mysql_secure_installation 

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!

In order to log into MariaDB to secure it, we'll need the current
password for the root user.  If you've just installed MariaDB, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none): 
OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.

Set root password? [Y/n] Y
New password: ISIKAN_PASSWORD_ANDA
Re-enter new password: ISIKAN_PASSWORD_ANDA
Password updated successfully!
Reloading privilege tables..
 ... Success!


By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n] Y
 ... Success!

Normally, root should only be allowed to connect from 'localhost'.  This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] Y
 ... Success!

By default, MariaDB comes with a database named 'test' that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n] Y
 - Dropping test database...
 ... Success!
 - Removing privileges on test database...
 ... Success!

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n] Y
 ... Success!

Cleaning up...

All done!  If you've completed all of the above steps, your MariaDB
installation should now be secure.

Thanks for using MariaDB!
[[email protected] ~]# 

Apabila Anda telah melakukan konfigurasi, selanjutnya mari kita coba login ke database MariaDB Anda lalu mencoba membuat database baru dengan menggunakan perintah berikut

[[email protected] ~]# 
[[email protected] ~]# mysql -u root -p
Enter password: ISIKAN_PASSWORD_DATABASE_ANDA
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 10
Server version: 5.5.60-MariaDB MariaDB Server

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)]> create database Hai;
Query OK, 1 row affected (0.00 sec)

MariaDB [(none)]> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| Hai                |
| mysql              |
| performance_schema |
+--------------------+
4 rows in set (0.00 sec)

MariaDB [(none)]> quit
Bye
[[email protected] ~]#

Oke, itulah cara untuk menginstall dan melakukan konfigurasi database MariaDB di sistem operasi CentOS 7.

Selamat mencoba semoga bermanfaat 🙂 .