GNU/Linux >> LINUX-Kenntnisse >  >> Fedora

So installieren Sie MySQL 8.0 auf Fedora 35 / Fedora 34

MySQL ist ein kostenloses Datenbankverwaltungssystem, das häufig in Webanwendungen zum Speichern und Abrufen von Datensätzen und Informationen verwendet wird. Es wurde ursprünglich von MYSQL AB entwickelt, das jetzt im Besitz der Oracle Corporation ist.

MySQL war die primäre Datenbank im Linux-Betriebssystem, bis MariaDB, eine Abzweigung von MySQL, ins Bild kam.

Hier sehen wir, wie man MySQL 8.0 auf Fedora 35 / Fedora 34 installiert.

MySQL-Repository hinzufügen

Fügen Sie zuerst das offizielle Repository von MySQL hinzu, um den MySQL-Community-Server zu installieren.

# 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

Überprüfen Sie dann, ob das MySQL-Repository aktiviert ist, indem Sie den folgenden Befehl verwenden.

sudo dnf repolist all | grep mysql | grep enabled

Ausgabe:

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

MySQL Community Server installieren

Installieren Sie MySQL 8.0

Verwenden Sie nach dem Hinzufügen des Repositorys den dnf Befehl ein, um den MySQL-Community-Server 8.0 zu installieren.

sudo dnf install -y mysql-community-server

Installieren Sie MySQL 5.7

MySQL 5.7 ist NICHT für Fedora 35 und Fedora 34 verfügbar

Nach der Installation des MySQL-Servers können Sie den Dienst mit folgendem Befehl starten.

sudo systemctl start mysqld

Aktivieren Sie dann den MySQL-Dienst beim Systemstart.

sudo systemctl enable mysqld

Überprüfen Sie abschließend den Status des MySQL-Servers mit dem folgenden Befehl.

sudo systemctl status mysqld

Anfängliches MySQL-Root-Passwort

In Fedora finden Sie das anfängliche MySQL-Root-Passwort in /var/log/mysqld.log . Sie können den folgenden Befehl verwenden, um das anfängliche Passwort aus der Protokolldatei abzurufen.

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

Ausgabe:

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

Sicherer MySQL-Server

Jetzt müssen Sie mysql_secure_installation ausführen um Ihre MySQL-Installation zu sichern. Dieser Befehl kümmert sich um das Setzen des Root-Passworts, das Entfernen anonymer Benutzer, das Verbieten der Root-Anmeldung aus der Ferne usw.

sudo mysql_secure_installation

Ausgabe:

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!

Mit MySQL-Server arbeiten

Jetzt können Sie mysql verwenden Befehl, um sich beim MySQL-Server anzumelden und die gewünschten Aktivitäten auszuführen.

mysql -u root -p

Ausgabe:

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>

Schlussfolgerung

Das ist alles. Ich hoffe, Sie haben gelernt, wie man MySQL 8.0 auf Fedora 35 / Fedora 34 installiert.


Fedora
  1. So installieren Sie MySQL 8.0 auf Fedora 35 / Fedora 34

  2. So installieren Sie MySQL 5.7 unter Amazon Linux

  3. So installieren Sie MySQL auf Fedora 35

  4. So installieren Sie die MySQL-Datenbank unter Ubuntu 20.04

  5. So installieren Sie MySQL unter Ubuntu 22.04

So installieren Sie MySQL unter Ubuntu Linux

So installieren Sie MySQL 8.0 unter Ubuntu 18.04

So installieren Sie den x11vnc-Server auf Fedora

So installieren Sie Go auf Fedora 35

So installieren Sie MySQL 8.0 auf Rocky Linux 8

So installieren Sie MySQL 8.0 auf Ubuntu 18.04