So wechseln Sie die Standardversion von MariaDB
In einigen Fällen müssen Sie die Version von MariaDB aktualisieren oder wechseln, um neue Funktionen oder Sicherheitspatches zu nutzen. Dieser Artikel beschreibt ausführlich, wie Sie die Standardversion von MariaDB in der ServBay-Umgebung wechseln können. Hier sind die spezifischen Schritte:
TIP
Im Folgenden wird ein Beispiel für die Migration von MariaDB 10.11 zu MariaDB 11.3 gegeben.
1. Sichern Sie zunächst die alte Version der Datenbank
Bevor Sie die Version von MariaDB wechseln, sollten Sie die vorhandene Datenbank sichern, um Datenverlust zu vermeiden. Mit dem Befehl mysqldump
können Sie alle Datenbanken einfach sichern.
mysqldump -uroot -p --all-databases --opt > mariadb_backup.sql
Bei der Ausführung des obigen Befehls werden Sie zur Eingabe des Root-Benutzerpassworts von MariaDB aufgefordert. Nach Abschluss der Sicherung finden Sie im aktuellen Verzeichnis eine Datei namens mariadb_backup.sql
.
2. Installieren Sie die benötigte neue Version, z.B. MariaDB 11.3
Im Verwaltungsbereich von ServBay finden Sie den Datenbankverwaltungsbereich, wählen MariaDB und klicken auf die Installation der benötigten neuen Version (z. B. MariaDB 11.3).
3. Deaktivieren Sie die alte Version, z.B. MariaDB 10.11
Nach der Installation der neuen Version müssen Sie die alte Version deaktivieren, um sicherzustellen, dass das System die neue Version von MariaDB verwendet. Finden Sie die alte Version (z.B. MariaDB 10.11) und deaktivieren Sie diese.
4. Aktivieren Sie die neue Version und bestätigen Sie, dass der Dienst ordnungsgemäß läuft
Nach der Deaktivierung der alten Version aktivieren Sie die neue Version von MariaDB und stellen sicher, dass der Dienst ordnungsgemäß läuft.
5. Wechseln Sie im Einstellungsbereich die Standardversion von MariaDB 10.11 zu MariaDB 11.3 und klicken Sie auf Apply
Als nächstes müssen Sie im Einstellungsbereich die Standardversion auf die neu installierte Version wechseln. Wählen Sie MariaDB 11.3 und klicken Sie auf Apply, um die Änderungen zu übernehmen.
6. Kehren Sie zum Administrationsbereich zurück und sehen Sie, dass die Standardversion erfolgreich eingestellt wurde
Im Administrationsbereich sollten Sie sehen können, dass die Standardversion erfolgreich zu MariaDB 11.3 gewechselt hat.
7. Geben Sie in der Befehlszeile mysql -V
ein, um zu sehen, dass die Version auf 11.3.2 gewechselt wurde
Geben Sie den folgenden Befehl in die Befehlszeile ein, um zu bestätigen, dass die Version von MariaDB erfolgreich gewechselt wurde:
mysql -V
Die Ausgabe sollte die aktuelle Version von MariaDB als 11.3.2 anzeigen.
8. Wiederherstellung der Datenbank
Nach dem Wechsel der Version müssen Sie die zuvor gesicherte Datenbank wiederherstellen. Verwenden Sie den folgenden Befehl, um die Datenbank wiederherzustellen:
mysql -uroot -p < mariadb_backup.sql
Das System fordert Sie auf, das Root-Benutzerpasswort von MariaDB einzugeben. Nach Eingabe des Passworts beginnt die Datenbankwiederherstellung.
9. Stellen Sie sicher, dass die Datenbank vollständig wiederhergestellt ist
Um sicherzustellen, dass die Datenbank vollständig wiederhergestellt wurde, können Sie sich bei MariaDB anmelden und die Daten prüfen:
mysql -uroot -p
Nach dem Login können Sie den folgenden Befehl verwenden, um die Datenbankliste anzuzeigen:
SHOW DATABASES;
Überprüfen Sie jede Datenbank und Tabelle, um sicherzustellen, dass die Daten vollständig und korrekt sind.
Durch die oben genannten Schritte haben Sie erfolgreich die Standardversion von MariaDB auf die neue Version gewechselt und die Datenbank wiederhergestellt. Wir hoffen, dass dieser Artikel Ihnen hilft, den Versionswechsel von MariaDB problemlos durchzuführen.