Lompat ke konten Lompat ke sidebar Lompat ke footer

Cara Install MySQL Server & phpmyadmin di Centos 8 Server

Cara Install MySQL Server & phpmyadmin di Centos 8 Server

Pada kesempatan kali ini saya akan share bagaimana Cara Install MySQL Server dan Phpmyadmin di Centos 8 Server dan cara konfigurasinya. Tutorial kali ini adalah lanjutan dari artikel sebelumnya yaitu Cara Install Web Server di Centos 8

Sebelum anda mengikuti tutorial ini, pastikan anda sudah menginstall Web server HTTPD jika belum, Silahkan lihat pada link dibawah ini.

MySQL adalah sebuah database management system (manajemen basis data) menggunakan perintah dasar SQL (Structured Query Language) yang cukup terkenal. Database management system (DBMS) MySQL multi pengguna dan multi alur ini sudah dipakai lebih dari 6 juta pengguna di seluruh dunia.

Pada tutorial kali ini sobat akan belajar cara install dan konfigurasi Database MySQL dan Phpmyadmin di centos 8 server. Langsung saja ikuti step by step Tutorial Cara Install MySQL Server & phpmyadmin di Centos 8 Server.

Installasi Database MySQL Server

Pertama kita cek Informasi MySQL-Server
[root@srv1 ~]# dnf info mysql-server
Last metadata expiration check: 1:34:43 ago on Tue 12 May 2020 07:34:39 PM WIB.
Available Packages
Name         : mysql-server
Version      : 8.0.17
Release      : 3.module_el8.0.0+181+899d6349
Architecture : x86_64
Size         : 22 M
Source       : mysql-8.0.17-3.module_el8.0.0+181+899d6349.src.rpm
Repository   : AppStream
Summary      : The MySQL server and related files
URL          : http://www.mysql.com
License      : GPLv2 with exceptions and LGPLv2 and BSD
Description  : MySQL is a multi-user, multi-threaded SQL database server. MySQL
             : is a client/server implementation consisting of a server daemon
             : (mysqld) and many different client programs and libraries. This
             : package contains the MySQL server and some accompanying files and
             : directories.
Silahkan jalankan perintah dibawah ini untuk Install database MySQL-Server
[root@srv1 ~]# dnf install -y mysql-server
Setelah selesai selanjutnya kita aktifkan service Mysql silahkan jalankan perintah dibawah ini
[root@srv1 ~]# systemctl start mysqld
[root@srv1 ~]# systemctl enable mysqld
Jangan lupa untuk mengecek service Mysql, pastikan statusnya active dan running
[root@srv1 ~]# systemctl status mysqld
mysqld.service - MySQL 8.0 database server
   Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor pres>
   Active: active (running) since Tue 2020-05-12 21:15:30 WIB; 17s ago
 Main PID: 15150 (mysqld)
   Status: "Server is operational"
    Tasks: 39 (limit: 11492)
   Memory: 523.7M
   CGroup: /system.slice/mysqld.service
           └─15150 /usr/libexec/mysqld --basedir=/usr

May 12 21:15:23 srv1.centos systemd[1]: Starting MySQL 8.0 database server...
May 12 21:15:23 srv1.centos mysql-prepare-db-dir[15066]: Initializing MySQL dat>
May 12 21:15:30 srv1.centos systemd[1]: Started MySQL 8.0 database server.
Karena database belum punya password selanjutnya jalankan perintah mysql_secure installation
[root@srv1 ~]# mysql_secure_installation

Securing the MySQL server deployment.

Connecting to MySQL using a blank password.

VALIDATE PASSWORD COMPONENT can be used to test passwords
and improve security. It checks the strength of password
and allows the users to set only those passwords which are
secure enough. Would you like to setup VALIDATE PASSWORD component?

Press y|Y for Yes, any other key for No:
Please set the password for root here.

New password: [Masukan Password]
Re-enter new password:[masukan Password]
By default, a MySQL installation has an anonymous user,
allowing anyone to log into MySQL 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

Remove anonymous users? (Press y|Y for Yes, any other key for No) : y

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? (Press y|Y for Yes, any other key for No) : y

By default, MySQL 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

Remove test database and access to it? (Press y|Y for Yes, any other key for No)                                                                                                                      : y
 - Dropping test database...

 - Removing privileges on test database...

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

Reload privilege tables now? (Press y|Y for Yes, any other key for No) : y

All done!
Untuk pengetesan silahkan login ke database lalu test buat databse
[root@srv1 ~]# mysql -u root -p
Enter password: [Masukan Password]
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 11
Server version: 8.0.17 Source distribution

Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective

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

mysql> create database dbtest;
Query OK, 1 row affected (0.01 sec)

mysql> show databases;
| Database           |
| dbtest             |
| information_schema |
| mysql              |
| performance_schema |
| sys                |
5 rows in set (0.00 sec)

mysql> exit

Cara Install MySQL Server & phpmyadmin di Centos 8 Server

Install PhpMyAdmin

Setelah kita install database MySQL selanjutnya kita install paket PHP terlebih dahulu
[root@srv1 ~]# dnf install php php-pdo php-pecl-zip php-json php-mbstring php-mysqlnd php-json php-mbstring
Selanjutnya download file phpmyadmin
[root@srv1 ~]# wget https://files.phpmyadmin.net/phpMyAdmin/5.0.1/phpMyAdmin-5.0.1-all-languages.zip
Unzip file phpmyadmin lalu taruh file tersebut pada direktory /usr/share/phpmyadmin
[root@srv1 ~]# unzip phpMyAdmin-5.0.1-all-languages.zip
[root@srv1 ~]# mv phpMyAdmin-5.0.1-all-languages /usr/share/phpmyadmin
Selanjutnya buat direktori tmp pada direktory /usr/share/phpmyadmin/ lalu ganti permission filenya
[root@srv1 ~]# mkdir /usr/share/phpmyadmin/tmp
[root@srv1 ~]# chown -R apache:apache /usr/share/phpmyadmin
[root@srv1 ~]# chmod 777 /usr/share/phpmyadmin/tmp
Tahap selanjutnya kita akan konfigurasi file phpmyadmin.conf
[root@srv1 ~]# nano /etc/httpd/conf.d/phpmyadmin.conf
Masukan Script dibawah ini
Alias /phpmyadmin /usr/share/phpmyadmin
<Directory /usr/share/phpmyadmin/>
   AddDefaultCharset UTF-8
   <IfModule mod_authz_core.c>
     # Apache 2.4
      Require all granted
<Directory /usr/share/phpmyadmin/setup/>
   <IfModule mod_authz_core.c>
 # Apache 2.4
       Require all granted
Simpan perubahan, Jika pada settingan SELinux aktif jalankan perintah dibawah ini untuk mengenable SELinux
[root@srv1 ~]# chcon -Rv --type=httpd_sys_content_t /usr/share/phpmyadmin/*
Jangan lupa untuk me-restart service httpd
[root@srv1 ~]# systemctl restart httpd


Setelah tahapan installasi dan konfigurasi Database dan Phpmyadmin, selanjutnya kita akan melakukan pengetesan, untuk pengetesan silahkan akses menggunakan browser dari PC Client akses menggunakan url  http://IP_Address_Server/phpmyadmin

cara, install, mysql, server, &, phpmyadmin, di centos, 8, server

Masukan user dan password Database MySQL Server yang sebelumnya kita buat. jika berhasil akan masuk pada Dashboard Phpmyadmin.

cara, install, mysql, server, &, phpmyadmin, di centos, 8, server

Untuk mengatasi pesan error pada phpmyadmin, Silahkan ikuti langkah-lankah dibawah ini.

cara, install, mysql, server, &, phpmyadmin, di centos, 8, server

Error 1
Klik Find out why > Create

Error 2 dan 3
Edit file config.sample.inc.php
[root@srv1 ~]# vim /usr/share/phpmyadmin/config.sample.inc.php

Pada baris 18 ganti menjadi
$cfg['blowfish_secret'] = 'qtdRoGmbc9{8IZr323xYcSN]0s)r$9b_JUnb{~Xz'; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! */

Pada baris 77 Tambahkan
$cfg['TempDir'] = '/tmp';

Ganti nama file config.sample.inc.php menjadi config.inc.php
[root@srv1 ~]# mv /usr/share/phpmyadmin/config.sample.inc.php /usr/share/phpmyadmin/config.inc.php

Demikian kira-kira tutorial Cara Install MySQL Server & phpmyadmin di Centos 8 Server ini saya buat. Semoga bermafaat untuk kita semua. Silahkan Share Jika Kalian merasa postingan ini bermanfaat. Sekian & Terimakasih Salam.

Artikel Selanjutnya : Cara Install Wordpress di Centos 8 Server

Posting Komentar untuk "Cara Install MySQL Server & phpmyadmin di Centos 8 Server"