GNU/Linux >> LINUX-Kenntnisse >  >> OpenSuse

So installieren Sie Mysql Server 8 auf OpenSUSE Leap 15.3

Mysql wird üblicherweise als Teil des beliebten LAMP- oder LEMP-Stacks (Linux, Apache/Nginx, MySQL/MariaDB, PHP/Python/Perl) installiert. Es implementiert das relationale Modell und die Structured Query Language (SQL), um Daten zu verwalten und abzufragen.

In dieser Anleitung werden wir mysql 8 auf OpenSUSE Leap 15.3 installieren.

Verwandte Inhalte

  • So installieren und konfigurieren Sie MySQL Server 8 auf Fedora 34/35
  • So installieren Sie Mysql 8 auf Rocky Linux/Centos 8
  • So installieren und konfigurieren Sie mysql 8 unter Ubuntu 20.04
  • Wie man Mysql 8 mit Docker und Docker-Compose ausführt
  • Verwenden von Ansible zum Installieren und Initialisieren von MySQL 8 auf Centos 8
  • Mysql-Berechtigungen – Datenbankbenutzer erstellen, aktualisieren, löschen
  • Nginx, WordPress und MySQL 8 in Centos 8 installieren und einrichten
  • Erstellen Sie eine RDS-Instanz in Terraform mit einem Mariadb-Beispiel

Inhaltsverzeichnis

  1. Sicherstellen, dass der Server auf dem neuesten Stand ist
  2. Mysql 8-Server installieren
  3. Starten und Aktivieren des MySQL-Dienstes
  4. Mysql-Installation sichern
  5. Mysql-Installation testen

Sicherstellen, dass der Server auf dem neuesten Stand ist

Bevor wir fortfahren, stellen wir sicher, dass unser OpenSUSE-Server auf dem neuesten Stand ist. Verwenden Sie diesen Befehl, um die Serverpakete zu aktualisieren:

sudo zypper ref
sudo zypper up -y

Lassen Sie uns als Nächstes allgemeine Pakete installieren, die wir in unserem Tutorial benötigen

sudo zypper in curl

Mysql 8-Server installieren

Nachdem unsere Pakete aktualisiert wurden, können wir mit der Installation von mysql server fortfahren. Die MySQL-Server-Pakete sind nicht in den Standard-Repositories von OpenSUSE zu finden, daher müssen wir die Mysql-Community-Repositories einrichten, bevor wir fortfahren. Verwenden Sie diesen Befehl, um das Repository-Installationspaket herunterzuladen:

> 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

Als nächstes installieren Sie das RPM-Paket:

sudo zypper install -y ./mysql80-community-release-sl15-3.noarch.rpm

Aktualisieren Sie nun die Repositorys, um die neu hinzugefügten Repositorys der Mysql-Community zu aktualisieren:

sudo zypper ref

Verwenden Sie diesen Befehl, um die Informationen des aufgelisteten Pakets zu überprüfen, um zu bestätigen, dass es die gewünschte MySQL-Version bereitstellt:

> 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.

Installieren Sie schließlich mysql server

sudo zypper install mysql-community-server

Überprüfen Sie nach der Installation die Installation mit diesem Befehl:

> 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)

Mysql-Dienst starten und aktivieren

Bis zu diesem Punkt haben wir es geschafft, den mysql-Dienst in unserem System zu installieren. Der Dienst wird standardmäßig nicht gestartet, daher müssen wir mit dem folgenden Befehl beginnen:

sudo systemctl start mysql

Verwenden Sie diesen Befehl, damit der Dienst bei Neustarts gestartet werden kann:

sudo systemctl enable mysql

Überprüfen Sie nun den Status des Dienstes, um zu bestätigen, dass er tatsächlich ausgeführt wird:

> 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.

Der Active: active (running) since ... zeigt an, dass der Dienst aktiv ist.

So zeigen Sie das MySQL 8-Dienstprotokoll mit dem Befehl journalctl wie folgt an:

$ sudo journalctl -u mysql -xe
$ sudo tail -f /var/log/mysql/mysqld.log

Mysql-Installation sichern

Wenn der Server zum ersten Mal gestartet wird, wird der Server initialisiert, und Folgendes passiert (wenn das Datenverzeichnis des Servers leer ist, wenn der Initialisierungsprozess beginnt):

  • Das SSL-Zertifikat und die Schlüsseldateien werden im Datenverzeichnis generiert.
  • Das Plug-in validate_password ist installiert und aktiviert.
  • Ein Superuser-Konto 'root'@'localhost' geschaffen. Ein Passwort für den Superuser wird festgelegt und in der Fehlerprotokolldatei gespeichert. Um es anzuzeigen, verwenden Sie den folgenden Befehl:
> 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
  • Ändern Sie das Root-Passwort so schnell wie möglich, indem Sie sich mit dem generierten, temporären Passwort anmelden und ein benutzerdefiniertes Passwort für das Superuser-Konto festlegen:
> 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)

Testen der MySQL-Installation

Lassen Sie uns die MySQL-Version mit diesem Befehl überprüfen:

> mysql -V
mysql  Ver 8.0.27 for Linux on x86_64 (MySQL Community Server - GPL)

Jetzt können Sie sich als root anmelden Benutzer und das oben angegebene Passwort.

> 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)

Schlussfolgerung

In diesem Artikel ist es uns gelungen, die Installation von MySQL 8 auf OpenSUSE Leap 15.3

zu installieren und zu testen
OpenSuse
  1. So installieren Sie MySQL 8.0 / 5.7 unter Debian 11 / Debian 10

  2. So installieren Sie Zend Server 5 auf openSUSE 12.1

  3. So installieren Sie Mongodb 5 in Opensuse Leap 15.3

  4. So installieren Sie MySQL Server unter Debian 9

  5. So installieren Sie MySQL unter Ubuntu 16.04

So installieren Sie Skype auf openSUSE Leap

So installieren Sie MySQL 8 unter CentOS 8

So installieren Sie MySQL-Server in Ubuntu

So installieren Sie TeamViewer 12 auf openSUSE Leap 42.2

So installieren Sie Dropbox auf openSUSE Leap 42.2

So installieren Sie MySQL Server unter Ubuntu 20.04