Install MySQL 5.7.* on Ubuntu 22.04, 24.04 dan 25.04
Last updated
Was this helpful?
Last updated
Was this helpful?
Download library dibawah ini dah ekstrak
Masuk ke folder yang sesui dengan versi ubuntu lu dan install
// folder ubuntu22 untuk ubuntu 22.04
sudo dpkg -i libtinfo22.deb
// folder ubuntu24 untuk ubuntu 24.04
sudo dpkg -i libaio24.deb
sudo dpkg -i libncurses24.deb
sudo dpkg -i libtinfo24.deb
// folder ubuntu25 untuk ubuntu 25.04
sudo dpkg -i libaio25.deb
sudo dpkg -i libncurses25.deb
sudo dpkg -i libtinfo25.deb
sudo apt update
wget
:// ubuntu 22.04, 24.04
sudo apt install wget -y
// ubuntu 25.04
sudo apt install wget gnupg -y
wget https://dev.mysql.com/get/mysql-apt-config_0.8.12-1_all.deb
sudo dpkg -i mysql-apt-config_0.8.12-1_all.deb
Saat muncul prompt, pilih Ubuntu Bionic, lalu klik OK.
Di prompt berikutnya, versi default adalah MySQL 8.0. Pilih opsi pertama (ganti ke MySQL 5.7) lalu klik OK.
Di prompt selanjutnya, pilih MySQL 5.7 Server, lalu klik OK.
Di prompt terakhir, MySQL 5.7 akan terpilih secara default. Pilih opsi terakhir "OK", lalu klik OK.
sudo apt-get update
sudo apt-cache policy mysql-server
// ubuntu 22.04, 24.04
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys B7B3B788A8D3785C
// ubuntu 25.04
sudo gpg --keyserver keyserver.ubuntu.com --recv-keys B7B3B788A8D3785C
sudo gpg --export B7B3B788A8D3785C | sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/mysql.gpg
sudo apt update
sudo apt install -f mysql-client=5.7* mysql-community-server=5.7* mysql-server=5.7*
Tekan y
untuk memulai instalasi.
Masukkan dan konfirmasi ulang password root saat diminta.
sudo mysql_secure_installation
Masukkan password root yang telah dibuat.
Pilih y
untuk mengaktifkan plugin VALIDATE PASSWORD.
Pilih tingkat validasi (0 = Rendah, 1 = Sedang, 2 = Tinggi), misalnya: 1
Pilih no
untuk tidak mengganti password root (jika sudah yakin).
Pilih y
untuk:
Menghapus user anonim
Menolak login root dari jarak jauh
Menghapus database test
Reload tabel hak akses
mysql -u root -p
SELECT VERSION();
CREATE USER 'sap'@'%' IDENTIFIED BY 'password';
grant all privileges on *.* to 'sap'@'%' with grant option;
flush privileges;
sudo nano /etc/mysql/mysql.conf.d/mysqld.cnf
bind-address
:Ubah dari:
bind-address = 127.0.0.1
Menjadi:
bind-address = 0.0.0.0
sudo systemctl restart mysql
Restart MySQL:
sudo systemctl restart mysql
Hentikan MySQL:
sudo systemctl stop mysql
Cek status MySQL:
sudo systemctl status mysql