Cara Install MariaDB di CentOS 8

MariaDB adalah salah satu perangkat lunak database jenis RDBMS paling populer. MariaDB merupakan fork dari MySQL database yang kini dimiliki oleh Oracle setelah mengakuisisi Sun Microsystems.

*0.Install MariaDB*

Secara default versi MariaDB yang berada di repository AppStream adalah MariaDB versi 10.3.11.

[INPUT]

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 dnf info mariadb   Available Packages Name         : mariadb-server Epoch        : 3 Version      : 10.3.11 Release      : 2.module_el8.0.0+35+6f2527ed Arch         : x86_64 Size         : 16 M Source       : mariadb-10.3.11-2.module_el8.0.0+35+6f2527ed.src.rpm Repo         : AppStream Summary      : The MariaDB server and related files URL          : http://mariadb.org License      : GPLv2 with exceptions and LGPLv2 and BSD. Description  : MariaDB is a multi-user, multi-threaded SQL database server. It is a              : client/server implementation consisting of a server daemon (mysqld)              : and many different client programs and libraries. This package contains              : the MariaDB server and some accompanying files and directories.              : MariaDB is a community developed branch of MySQL.

Jika ingin menggunakan versi terbaru dari MariaDB, pasang repository MariaDB.

Untuk tutorial ini menggunakan repository default dari CentOS 8.

[INPUT]

1 2 3 4 dnf install mariadb-server -y systemctl enable mariadb systemctl start mariadb systemctl status mariadb

*1.Amankan Instalasi MariaDB*

Langkah selanjutnya mengamankan instalasi MariaDB.

[INPUT]

1 2 3 4 5 6 7 8 mysql_secure_installation   Enter current password for root (enter for none): ENTER Set root password? [Y/n] y Remove anonymous users? [Y/n] y Disallow root login remotely? [Y/n] y Remove test database and access to it? [Y/n] y Reload privilege tables now? [Y/n] y

*2.Akses MariaDB*

Login ke MariaDB melalui mysql command line.

[INPUT]

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 mysql -u root -p   Enter password: Welcome to the MariaDB monitor.  Commands end with ; or \g. Your MariaDB connection id is 16 Server version: 10.3.11-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)]> show databases; +——————–+ | Database           | +——————–+ | information_schema | | mysql              | | performance_schema | +——————–+ 3 rows in set (0.002 sec)

*3.Membuat Database dan User*

Demi keamanan disarankan membuat database dan usernya, jangan menggunakan user root untuk mengakses seluruh database di aplikasi.

[INPUT]

1 2 3 4 5 create database wordpress; create user ‘user_wordpress’@’localhost’ identified by ‘password_wordpress’; grant all privileges on wordpress.* to ‘user_wordpress’@’localhost’; flush privileges; exit;

Verifikasi database dan user yang sudah dibuat dengan login kembali ke MariaDB dan menampilkan databasenya.

[INPUT]

1 2 3 4 5 6 7 8 9 10 mysql -u user_wordpress -p   MariaDB [(none)]> show databases;   +——————–+ | Database           | +——————–+ | information_schema | | wordpress          | +——————–+

Selamat mencoba 🙂

Leave a Reply

Your email address will not be published.