Cara Install MySQL 8 di Ubuntu 18.04

MySQL adalah perangkat lunak open source untuk Relational Database Management System. MySQL merupakan salah satu dari paket aplikasi server untuk website yang sering disebut sebagai LAMP (Linux Apache MySQL PHP) server.

*0.Pasang Repository*

Secara default versi MySQL yang tersedia di Ubuntu 18.04 adalah MySQL 5.7.

apt show mysql-server v5.7

Agar bisa menginstalasi MySQL 8 di Ubuntu 18.04 terlebih dahulu memasang repository MySQL.

Download file konfigurasi repostiory MySQL 8.


1 curl -OL

Instalasi file .deb yang telah didownload.


1 sudo dpkg -i mysql-apt-config_0.8.15-1_all.deb

Ditampilkan pertanyaan *Which MySQL product do you wish to configure?*, pilih *Ok*.

Configuring mysql-apt-config

Jalankan update.


1 sudo apt update

Verifikasi versi mysql-server.


1 apt show mysql-server

apt show mysql-server v8.0

*1.Install MySQL*

Setelah repository MySQL terpasang, jalankan perintah install.


1 sudo apt install mysql-server -y

Masukkan password user root MySQL.

Enter root password

Lalu *Ok*.

Informasi metode authentication

Pilih *Use Strong Password Encryption (RECOMENDED)*.

Memilih authentication plugin

Setelah instalasi selesai, periksa status service mysql, harus *active (running)*.


1 sudo systemctl status mysql

Status mysql service

*2.Mengamankan MySQL*

Mengamankan instalasi MySQL.


1 sudo mysql_secure_installation

Masukkan password user root.


1 2 3 Securing the MySQL server deployment.   Enter password for user root: PASSWORD_ROOT

VALIDATE PASSWORD COMPONENT untuk menggunakan password user MySQL yang kuat. Jawab *y* jika ingin mengaktifkannya.


1 2 3 4 5 6 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: y

Memilih level kekuatan password.


1 2 3 4 5 6 7 There are three levels of password validation policy:   LOW    Length >= 8 MEDIUM Length >= 8, numeric, mixed case, and special characters STRONG Length >= 8, numeric, mixed case, special characters and dictionary file   Please enter = LOW, 1 = MEDIUM and 2 = STRONG: 1

Mengubah password root, jawab *n* jika tidak ingin mengubahnya.


1 2 Estimated strength of the password: Change the password for root ? ((Press y|Y for Yes, any other key for No) : n

Hapus user anonymous, jawab *y*.


1 2 3 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 environment.   Remove anonymous users? (Press y|Y for Yes, any other key for No) : y

Tidak mengijinkan root untuk melakukan remote database, jawab *y*.


1 2 3 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

Hapus database test, jawab *y*.


1 2 3 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 environment.   Remove test database and access to it? (Press y|Y for Yes, any other key for No) : y

Reload tabel privileges, jawab *y*.


1 2 3 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


Login ke mysql dengan user root.


1 sudo mysql -u root -p

Login ke mysql

Selamat mencoba 🙂

Leave a Reply

Your email address will not be published.