Skip to content

Konfigurasi Mysql dan PHPMyAdmin

Installasi Mariadb

Setting Repository

root@webserver-rehan:/etc/apache2/sites-available# nano /etc/apt/sources.list
hapus semua kemudian isikan seperti dibawah ini

deb http://deb.debian.org/debian bullseye main
deb-src http://deb.debian.org/debian bullseye main

deb http://security.debian.org/debian-security bullseye-security main
deb-src http://security.debian.org/debian-security bullseye-security main

deb http://deb.debian.org/debian bullseye-updates main
deb-src http://deb.debian.org/debian bullseye-updates main

deb http://deb.debian.org/debian bullseye-backports main
deb-src http://deb.debian.org/debian bullseye-backports main
root@webserver-rehan:/etc/apache2/sites-available# apt update

install mariadb

root@webserver-rehan:/etc/apache2/sites-available# apt install mariadb-server mariadb-client -y

root@webserver-rehan:/etc/apache2/sites-available# mysql_secure_installation
Enter current password for root (enter for none):  
Switch to unix_socket authentication [Y/n] n  
Change the root password? [Y/n] n  
Disallow root login remotely? [Y/n] y  
Remove test database and access to it? [Y/n] y  
Reload privilege tables now? [Y/n] y  

Membuat user Mysql Baru

root@webserver-rehan:/etc/apache2/sites-available# mysql -u root -p
MariaDB [(none)]> create user 'userdb'@'%' identified by '1234';
MariaDB [(none)]> grant all privileges on *.* to 'userdb'@'%';
MariaDB [(none)]> exit

Installasi phpMyAdmin

root@webserver-rehan:/etc/apache2/sites-available# cd /root

Install kebutuhan PHP

root@webserver-rehan:~# apt -y install php php-cgi php-mysqli php-pear php-mbstring libapache2-mod-php php-common php-phpseclib php-mysql

Download PhpMyAdmin

root@webserver-rehan:~# apt install -y wget
root@webserver-rehan:~# wget -P Downloads https://www.phpmyadmin.net/downloads/phpMyAdmin-latest-all-languages.tar.gz
root@webserver-rehan:~# wget -P Downloads https://files.phpmyadmin.net/phpmyadmin.keyring
root@webserver-rehan:~# cd Downloads/
root@webserver-rehan:~/Downloads# apt install gnupg -y
root@webserver-rehan:~/Downloads# gpg --import phpmyadmin.keyring

root@webserver-rehan:~/Downloads# wget https://www.phpmyadmin.net/downloads/phpMyAdmin-latest-all-languages.tar.gz.asc
root@webserver-rehan:~/Downloads# gpg --verify phpMyAdmin-latest-all-languages.tar.gz.asc

Extract PhpMyAdmin

root@webserver-rehan:~/Downloads# mkdir /var/www/html/phpMyAdmin
root@webserver-rehan:~/Downloads# tar xvf phpMyAdmin-latest-all-languages.tar.gz --strip-components=1 -C /var/www/html/phpMyAdmin

KOnfigurasi Apache phpmyadmin

root@webserver-rehan:~/Downloads# chown -R www-data:www-data /var/www/html/phpMyAdmin
root@webserver-rehan:/var/www/html/phpMyAdmin# cd /etc/apache2/sites-available/
root@webserver-rehan:/etc/apache2/sites-available# nano test.conf  

Alt text

root@webserver-rehan:/etc/apache2/sites-available# a2dissite 000-default.conf
root@webserver-rehan:/etc/apache2/sites-available# service apache2 restart

Testing

Akses phpmyadmin via broser

Alt text