MariaDB ist das beliebteste Open-Source-Datenbankverwaltungssystem. Es wird von kleinen bis großen Unternehmen zum Speichern von Daten verwendet.
MariaDB ist eine Abzweigung des berühmten Datenbankservers MySQL, entwickelt von der MariaDB Corporation Ab, geführt von den ursprünglichen Entwicklern von MySQL. Es ist vollständig kompatibel mit der MySQL-Datenbank, um eine Drop-In-Ersatzfunktion zu gewährleisten, und wird als Datenbankserver im LAMP- und LEMP-Stack verwendet.
In diesem Beitrag werden wir sehen, wie MariaDB auf CentOS 6 / RHEL 6 installiert wird.
Installieren Sie MariaDB auf CentOS 6 / RHEL 6
MariaDB-Repository hinzufügen
MariaDB Foundation bietet MariaDB-Pakete für CentOS 6 / RHEL 6 an. Pakete, die von der MariaDB-Community bereitgestellt werden, sind immer auf dem neuesten Stand und werden von ihnen unterstützt.
MariaDB-Repository zum System hinzufügen.
CentOS 6
### CentOS 6 64 Bit ### cat <<EOF >> /etc/yum.repos.d/mariadb.repo [mariadb] name = MariaDB baseurl = http://yum.mariadb.org/10.3/centos6-amd64 gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB gpgcheck=1 EOF ### CentOS 6 32 Bit ### cat <<EOF >> /etc/yum.repos.d/mariadb.repo [mariadb] name = MariaDB baseurl = http://yum.mariadb.org/10.3/centos6-x86 gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB gpgcheck=1 EOF
RHEL 6
### RHEL 6 64 Bit ### cat <<EOF >> /etc/yum.repos.d/mariadb.repo [mariadb] name = MariaDB baseurl = http://yum.mariadb.org/10.3/rhel6-amd64 gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB gpgcheck=1 EOF ### RHEL 6 32 Bit ### cat <<EOF >> /etc/yum.repos.d/mariadb.repo [mariadb] name = MariaDB baseurl = http://yum.mariadb.org/10.3/rhel6-x86 gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB gpgcheck=1 EOF
Installieren Sie den MariaDB-Server mit dem folgenden Befehl.
yum install -y MariaDB-server MariaDB-client
MariaDB-Dienst verwalten
Starten Sie den MariaDB (mysql)-Dienst mit dem folgenden Befehl.
service mysql start
Überprüfen Sie, ob der MariaDB-Dienst ausgeführt wird oder nicht.
service mysql status
Stellen Sie den MariaDB-Server so ein, dass er beim Systemstart automatisch gestartet wird.
chkconfig mysql on
Sichere MariaDB-Installation
Führen Sie den Befehl mysql_secure_installation aus, um die Ersteinrichtung des MariaDB-Servers durchzuführen.
Es wird empfohlen, diese Ersteinrichtung auf Produktions-Linux-Servern durchzuführen, um anonyme Benutzer zu entfernen, die Datenbank zu testen und die Remote-Root-Anmeldung zu unterbinden.
mysql_secure_installation
Ausgabe:
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 you haven't set the root password yet, the password will be blank, so you should just press enter here. Enter current password for root (enter for none): << No root password. Just press Enter OK, successfully used password, moving on... Setting the root password ensures that nobody can log into the MariaDB root user without the proper authorisation. Set root password? [Y/n] Y << Set MariaDB root password New password: << Enter root password Re-enter new password: << Re-enter root 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 privilege ... 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
Melden Sie sich beim MariaDB-Server an.
mysql -u root -p
Ausgabe:
Schlussfolgerung
Das ist alles. Ich hoffe, Sie haben verstanden, wie MariaDB unter CentOS 6 / RHEL 6 installiert wird. Lesen Sie die MariaDB-Artikel für Anfänger, um mehr über die Arbeit mit MariaDB zu erfahren.