Mysql biasanya diinstal sebagai bagian dari tumpukan LAMP atau LEMP (Linux, Apache/Nginx, MySQL/MariaDB, PHP/Python/Perl) yang populer. Ini mengimplementasikan model relasional dan Structured Query Language (SQL) untuk mengelola dan mengkueri data.
Dalam panduan ini kita akan menginstal mysql 8 pada OpenSUSE Leap 15.3.
Konten Terkait
- Cara menginstal dan Konfigurasi Mysql Server 8 di Fedora 34/35
- Cara menginstal Mysql 8 di Rocky Linux/Centos 8
- Cara Menginstal dan Mengatur mysql 8 di Ubuntu 20.04
- Cara menjalankan Mysql 8 dengan Docker dan Docker-Compose
- Menggunakan Kemungkinan untuk Menginstal dan Menginisialisasi Mysql 8 di Centos 8
- Izin MySQL – Buat, Perbarui, Hapus Pengguna Basis Data
- Instal dan Setup Nginx, WordPress dan Mysql 8 di Centos 8
- Buat instance RDS di terraform dengan Contoh Mariadb
Daftar Isi
- Memastikan server selalu terbaru
- Menginstal server Mysql 8
- Memulai dan mengaktifkan layanan mysql
- Mengamankan instalasi mysql
- Menguji instalasi mysql
Memastikan Server Terkini
Sebelum melanjutkan, izinkan kami memastikan bahwa server OpenSUSE kami mutakhir. Gunakan perintah ini untuk memperbarui paket server:
sudo zypper ref
sudo zypper up -y
Selanjutnya, mari kita instal paket-paket umum yang akan kita perlukan dalam tutorial kita
sudo zypper in curl
Menginstal server Mysql 8
Sekarang paket kami diperbarui, kami dapat melanjutkan untuk menginstal server mysql. Paket server mysql tidak ditemukan di repositori default OpenSUSE, jadi kita perlu mengatur repositori Komunitas Mysql sebelum melanjutkan. Gunakan perintah ini untuk mengunduh paket instalasi repositori:
> curl -LO https://dev.mysql.com/get/mysql80-community-release-sl15-3.noarch.rpm
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
100 29772 100 29772 0 0 29891 0 --:--:-- --:--:-- --:--:-- 57034
Selanjutnya, instal paket rpm:
sudo zypper install -y ./mysql80-community-release-sl15-3.noarch.rpm
Sekarang segarkan repositori untuk memperbarui repositori komunitas mysql yang baru ditambahkan:
sudo zypper ref
Gunakan perintah ini untuk memeriksa info paket yang terdaftar untuk mengonfirmasi bahwa paket tersebut menyediakan versi mysql yang kita inginkan:
> sudo zypper info mysql-community-server
Loading repository data...
Reading installed packages...
Information for package mysql-community-server:
-----------------------------------------------
Repository : MySQL 8.0 Community Server
Name : mysql-community-server
Version : 8.0.27-1.sl15
Arch : x86_64
Vendor : Oracle and/or its affiliates
Installed Size : 2.83 GiB
Installed : Yes
Status : up-to-date
Source package : mysql-community-8.0.27-1.sl15.src
Summary : A very fast and reliable SQL database server
Description :
The MySQL(TM) software delivers a very fast, multi-threaded, multi-user,
and robust SQL (Structured Query Language) database server. MySQL Server
is intended for mission-critical, heavy-load production systems as well
as for embedding into mass-deployed software. MySQL is a trademark of
Oracle and/or its affiliates
The MySQL software has Dual Licensing, which means you can use the MySQL
software free of charge under the GNU General Public License
(http://www.gnu.org/licenses/). You can also purchase commercial MySQL
licenses from Oracle and/or its affiliates if you do not wish to be bound by the terms of
the GPL. See the chapter "Licensing and Support" in the manual for
further info.
The MySQL web site (http://www.mysql.com/) provides the latest news and
information about the MySQL software. Also please see the documentation
and the manual for more information.
This package includes the MySQL server binary as well as related utilities
to run and administer a MySQL server.
Terakhir, Instal server mysql
sudo zypper install mysql-community-server
Setelah terinstal, verifikasi instalasi menggunakan perintah ini:
> rpm -qi mysql-community-server
Name : mysql-community-server
Version : 8.0.27
Release : 1.sl15
Architecture: x86_64
Install Date: Tue Nov 2 02:56:29 2021
Group : Applications/Databases
Size : 3039099718
License : Copyright (c) 2000, 2021, Oracle and/or its affiliates. Under GPLv2 license as shown in the Description field.
Signature : DSA/SHA256, Wed Sep 29 07:36:37 2021, Key ID 8c718d3b5072e1f5
Source RPM : mysql-community-8.0.27-1.sl15.src.rpm
Build Date : Tue Sep 28 15:13:00 2021
Build Host : pb2-opensuse15-01.appad3iad.mysql2iad.oraclevcn.com
Relocations : (not relocatable)
Packager : MySQL Release Engineering <[email protected]>
Vendor : Oracle and/or its affiliates
URL : http://www.mysql.com/
Summary : A very fast and reliable SQL database server
Description :
The MySQL(TM) software delivers a very fast, multi-threaded, multi-user,
and robust SQL (Structured Query Language) database server. MySQL Server
is intended for mission-critical, heavy-load production systems as well
as for embedding into mass-deployed software. MySQL is a trademark of
Oracle and/or its affiliates
The MySQL software has Dual Licensing, which means you can use the MySQL
software free of charge under the GNU General Public License
(http://www.gnu.org/licenses/). You can also purchase commercial MySQL
licenses from Oracle and/or its affiliates if you do not wish to be bound by the terms of
the GPL. See the chapter "Licensing and Support" in the manual for
further info.
The MySQL web site (http://www.mysql.com/) provides the latest news and
information about the MySQL software. Also please see the documentation
and the manual for more information.
This package includes the MySQL server binary as well as related utilities
to run and administer a MySQL server.
Distribution: (none)
Memulai dan mengaktifkan layanan mysql
Sampai saat ini kami berhasil menginstal layanan mysql di sistem kami. Layanan tidak akan dimulai secara default, jadi kita harus memulai dengan mengeluarkan perintah berikut:
sudo systemctl start mysql
Untuk mengaktifkan layanan untuk memulai saat reboot, gunakan perintah ini:
sudo systemctl enable mysql
Sekarang periksa status layanan untuk mengonfirmasi bahwa itu benar-benar berjalan:
> sudo systemctl status mysql
● mysql.service - MySQL Server
Loaded: loaded (/usr/lib/systemd/system/mysql.service; enabled; vendor preset: disabled)
Active: active (running) since Tue 2021-11-02 03:00:27 UTC; 31s ago
Docs: man:mysqld(8)
http://dev.mysql.com/doc/refman/en/using-systemd.html
Main PID: 28418 (mysqld)
Status: "Server is operational"
Tasks: 38 (limit: 4587)
CGroup: /system.slice/mysql.service
└─28418 /usr/sbin/mysqld
Nov 02 03:00:21 ip-10-2-40-60 systemd[1]: Starting MySQL Server...
Nov 02 03:00:27 ip-10-2-40-60 systemd[1]: Started MySQL Server.
Active: active (running) since ...
menunjukkan bahwa layanan aktif dan berjalan.
Untuk melihat log layanan MySQL 8 sebagai berikut menggunakan perintah journalctl:
$ sudo journalctl -u mysql -xe
$ sudo tail -f /var/log/mysql/mysqld.log
Mengamankan instalasi mysql
Saat server dijalankan pertama kali, server diinisialisasi, dan berikut ini terjadi (jika direktori data server kosong saat proses inisialisasi dimulai):
- Sertifikat SSL dan file kunci dibuat di direktori data.
- Plugin validate_password dipasang dan diaktifkan.
- Akun pengguna super
'root'@'localhost'
dibuat. Kata sandi untuk pengguna super ditetapkan dan disimpan dalam file log kesalahan. Untuk mengungkapkannya, gunakan perintah berikut:
> sudo grep 'temporary password' /var/log/mysql/mysqld.log
2021-11-02T03:00:23.175267Z 6 [Note] [MY-010454] [Server] A temporary password is generated for [email protected]: nGbo0jV#-OZZ
- Ubah kata sandi root sesegera mungkin dengan masuk dengan kata sandi sementara yang dibuat dan setel kata sandi khusus untuk akun pengguna super:
> mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 17
Server version: 8.0.27
Copyright (c) 2000, 2021, Oracle and/or its affiliates.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'nYd3#Mt7Dkh42Zu5M5L!9TAM';
Query OK, 0 rows affected (0.02 sec)
Menguji Instalasi MySQL
Mari kita periksa versi mysql dengan perintah ini:
> mysql -V
mysql Ver 8.0.27 for Linux on x86_64 (MySQL Community Server - GPL)
Sekarang Anda dapat Login sebagai root
pengguna dan kata sandi yang ditentukan di atas.
> mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 17
Server version: 8.0.27
Copyright (c) 2000, 2021, Oracle and/or its affiliates.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> select version();
+-----------+
| version() |
+-----------+
| 8.0.27 |
+-----------+
1 row in set (0.00 sec)
Kesimpulan
Pada artikel ini, kami berhasil menginstal dan menguji instalasi mysql 8 di OpenSUSE Leap 15.3