GNU/Linux >> LINUX-Kenntnisse >  >> Arch Linux

So installieren Sie MariaDB unter Arch Linux / Manjaro Linux

MariaDB ist ein sehr beliebtes Open-Source-Datenbankverwaltungssystem, das jeder verwendet, von kleinen bis zu großen Unternehmen. Es ist ein Fork von MySQL von MariaDB Corporation Ab, geführt von den ursprünglichen Entwicklern von MySQL.

MariaDB ist vollständig kompatibel mit der MySQL-Datenbank und wird häufig als Datenbankserver im LAMP- und LEMP-Stack verwendet.

In diesem Beitrag werden wir sehen, wie MariaDB auf Arch Linux / Manjaro Linux installiert wird.

Installieren Sie MariaDB auf Arch Linux / Manjaro Linux

MariaDB Foundation verteilt Pakete über dedizierte Repositories für die meisten Linux-Betriebssysteme. Da Arch Linux einem Rolling-Release-Modell folgt, können Sie die neueste Version von MariaDB von Arch Linux Mirrors erhalten.

Arch Linux aktualisieren

Aktualisieren Sie zunächst alle Pakete, um Ihr System auf die neueste Version zu bringen.

pacman -Syu

Starten Sie dann das System neu.

reboot

Installieren Sie MariaDB

Installieren Sie nun das MariaDB-Paket vom nächstgelegenen Mirror.

pacman -Sy mariadb

Bevor Sie den MariaDB-Dienst starten, initialisieren Sie die Datenbank mit dem folgenden Befehl. Sie können auch das Datenverzeichnis Ihrer Wahl ändern, vorausgesetzt, Sie setzen datadir=YOUR_DATADIR unter dem Abschnitt [mysqld] von /etc/my.cnf.d/server.cnf .

mariadb-install-db --user=mysql --basedir=/usr --datadir=/var/lib/mysql

Starten und aktivieren Sie abschließend den MariaDB-Dienst mit dem folgenden Befehl.

systemctl enable --now mariadb

Sobald der Dienst aktiv ist, überprüfen Sie den Status des MariaDB-Dienstes.

systemctl status mariadb

Sichere MariaDB-Installation

Nach der Installation von MariaDB müssen Sie den Befehl mysql_secure_installation ausführen, um anonyme Benutzer zu entfernen, Datenbanken zu testen und die Remote-Root-Anmeldung zu verbieten.

mysql_secure_installation

Offizieller MariaDB-Mirror

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!

In order to log into MariaDB to secure it, we'll need the current
password for the root user. If you've just installed MariaDB, and
haven't set the root password yet, you should just press enter here.

Enter current password for root (enter for none):  << Just press enter
OK, successfully used password, moving on...

Setting the root password or using the unix_socket ensures that nobody
can log into the MariaDB root user without the proper authorisation.

You already have your root account protected, so you can safely answer 'n'.

Switch to unix_socket authentication [Y/n] N  << Disable Unix Socket Authentication
 ... skipping.

You already have your root account protected, so you can safely answer 'n'.

Change the root password? [Y/n] Y  << Change Root Password
New password:  << Enter Password
Re-enter new password:  << Re-Enter Password
Password updated successfully!
Reloading privilege tables..
 ... Success!


By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB 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? [Y/n] Y  << 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? [Y/n] Y  << Disallow root login remotely
 ... Success!

By default, MariaDB 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? [Y/n] Y  << 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? [Y/n] Y  << Reload Tables
 ... Success!

Cleaning up...

All done!  If you've completed all of the above steps, your MariaDB
installation should now be secure.

Thanks for using MariaDB!

Zugriff auf MariaDB

Sie können sich jetzt mit dem MySQL-Root-Passwort bei der MariaDB-Datenbank anmelden.

mysql -u root -p

Ausgabe:

Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 12
Server version: 10.7.3-MariaDB Arch Linux

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]>

Schlussfolgerung

Das ist alles. Ich hoffe, Sie haben gelernt, wie man MariaDB unter Arch Linux / Manjaro Linux installiert und die Ersteinrichtung durchführt. Sie könnten auch daran interessiert sein, MariaDB-Einsteigerartikel zu lesen, um mit MariaDB zu beginnen.


Arch Linux
  1. So installieren Sie Arch Linux

  2. So installieren Sie den LEMP-Stack unter Arch Linux

  3. So installieren Sie Pacaur in Arch Linux

  4. So installieren Sie yay (AUR-Hilfsprogramm) in Manjaro/Arch Linux

  5. So installieren Sie Go (Golang) in Arch Linux/Manjaro

So installieren Sie die neueste Version von Arch Linux

So installieren Sie LEMP auf Manjaro 20

So installieren Sie MariaDB auf Manjaro 21

So installieren Sie Yay AUR Helper in Arch Linux und Manjaro

So installieren Sie Skype unter Arch Linux

So installieren Sie Java unter Arch Linux