GNU/Linux >> Belajar Linux >  >> Fedora

Cara Menginstal MySQL 8.0 di Fedora 35 / Fedora 34

MySQL adalah sistem manajemen database gratis yang biasa digunakan dalam aplikasi web untuk menyimpan dan mengambil catatan dan informasi. Ini awalnya dikembangkan oleh MYSQL AB, sekarang dimiliki oleh Oracle Corporation.

MySQL adalah database utama dalam sistem operasi Linux sampai MariaDB, turunan dari MySQL, muncul.

Di sini, kita akan melihat cara menginstal MySQL 8.0 di Fedora 35 / Fedora 34.

Tambahkan Repositori MySQL

Pertama, tambahkan repositori resmi MySQL untuk menginstal server komunitas MySQL.

# Fedora 35

sudo rpm -ivh https://dev.mysql.com/get/mysql80-community-release-fc35-1.noarch.rpm

# Fedora 34

sudo rpm -ivh https://dev.mysql.com/get/mysql80-community-release-fc34-2.noarch.rpm

Kemudian, periksa apakah repositori MySQL diaktifkan dengan menggunakan perintah berikut.

sudo dnf repolist all | grep mysql | grep enabled

Keluaran:

mysql-connectors-community                MySQL Connectors Community    enabled
mysql-tools-community                     MySQL Tools Community         enabled
mysql80-community                         MySQL 8.0 Community Server    enabled

Instal Server Komunitas MySQL

Instal MySQL 8.0

Setelah menambahkan repositori, gunakan dnf perintah untuk menginstal server komunitas MySQL 8.0.

sudo dnf install -y mysql-community-server

Instal MySQL 5.7

MySQL 5.7 TIDAK tersedia untuk Fedora 35 dan Fedora 34

Setelah instalasi server MySQL, Anda dapat memulai layanan menggunakan perintah berikut.

sudo systemctl start mysqld

Kemudian, aktifkan layanan MySQL saat startup sistem.

sudo systemctl enable mysqld

Terakhir, verifikasi status server MySQL menggunakan perintah berikut.

sudo systemctl status mysqld

Kata Sandi Root MySQL Awal

Di Fedora, Anda dapat menemukan kata sandi root MySQL awal di /var/log/mysqld.log . Anda dapat menggunakan perintah di bawah ini untuk mendapatkan kata sandi awal dari file log.

sudo cat /var/log/mysqld.log | grep -i 'temporary password'

Keluaran:

2021-11-27T07:52:26.014940Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: mSa1,T_!xPyp

Server MySQL aman

Sekarang, Anda perlu menjalankan mysql_secure_installation untuk mengamankan instalasi MySQL Anda. Perintah ini menangani pengaturan kata sandi root, menghapus pengguna anonim, melarang login root dari jarak jauh, dll.

sudo mysql_secure_installation

Keluaran:

Securing the MySQL server deployment.

Enter password for user root:  << Enter the initital MySQL root password

The existing password for the user account root has expired. Please set a new password.

New password:  << Enter new MySQL root password

Re-enter new password:  << Re-enter new MySQL root password
The 'validate_password' component is installed on the server.
The subsequent steps will run with the existing configuration
of the component.
Using existing password for root.

Estimated strength of the password: 100
Change the password for root ? ((Press y|Y for Yes, any other key for No) : N  << Type N as we have already set new password

 ... skipping.
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  << Type Y to remove anonymous users
Success.


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  << Type Y to disallow root login remotely
Success.

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  << Type Y to remove test database
 - Dropping test database...
Success.

 - Removing privileges on test database...
Success.

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  << Type Y to reload privilege tables
Success.

All done!

Bekerja dengan Server MySQL

Sekarang, Anda dapat menggunakan mysql perintah untuk masuk ke server MySQL dan melakukan aktivitas yang diinginkan.

mysql -u root -p

Keluaran:

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 12
Server version: 8.0.27 MySQL Community Server - GPL

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>

Kesimpulan

Itu saja. Saya harap Anda telah mempelajari cara menginstal MySQL 8.0 di Fedora 35 / Fedora 34.


Fedora
  1. Cara Menginstal MySQL 8.0 di Fedora 35 / Fedora 34

  2. Cara Menginstal MySQL di Fedora 35

  3. Bagaimana Cara Menginstal MySQL di CentOS 7.x?

  1. Cara Menginstal MySQL 5.7 di Amazon Linux

  2. Cara Menginstal MySQL di Ubuntu 18.04

  3. Cara Menginstal MySQL di Ubuntu 22.04

  1. Cara Menginstal MySQL di Ubuntu 20.04

  2. Cara Menginstal MySQL di Debian 9

  3. Cara Menginstal Database MySQL di Ubuntu 20.04