MariaDB-Einstellungen ändern
ServBay wird mit der MariaDB-Datenbank geliefert und bietet flexible Konfigurationsoptionen. Dieser Artikel beschreibt ausführlich, wie die MariaDB-Einstellungen in ServBay geändert werden können, einschließlich des Speicherorts der Konfigurationsdateien und der häufigen Konfigurationsoptionen. Je nach MariaDB-Version befinden sich diese Dateien im Verzeichnis /Applications/ServBay/etc/mariadb/<version>
.
Übersicht
In ServBay werden die Konfigurationsdateien von MariaDB je nach Version in verschiedenen Verzeichnissen gespeichert. Zum Beispiel befindet sich die Konfigurationsdatei für MariaDB 11.5 im Verzeichnis /Applications/ServBay/etc/mariadb/11.5
. Die Hauptkonfigurationsdatei ist my.cnf
.
Speicherort der Konfigurationsdateien
my.cnf
:/Applications/ServBay/etc/mariadb/<version>/my.cnf
Häufige Konfigurationsoptionen und Änderungsmethoden
my.cnf
my.cnf
ist die Hauptkonfigurationsdatei von MariaDB und wird verwendet, um Laufzeiteinstellungen des Datenbankservers zu konfigurieren.
Häufige Konfigurationsoptionen
Ändern der Abhöradresse:
[mysqld] bind-address = 0.0.0.0
1
2Ändern der Portnummer:
[mysqld] port = 3306
1
2Ändern der maximalen Verbindungen:
[mysqld] max_connections = 200
1
2Ändern der Pufferpoolgröße:
[mysqld] innodb_buffer_pool_size = 256M
1
2Ändern des Pfads der Protokolldatei:
[mysqld] log_error = /Applications/ServBay/logs/mariadb/error.log
1
2Aktivieren des Slow-Query-Logs:
[mysqld] slow_query_log = 1 slow_query_log_file = /Applications/ServBay/logs/mariadb/slow.log long_query_time = 2 # In Sekunden, Aufzeichnungen von Abfragen, die länger als 2 Sekunden dauern
1
2
3
4Ändern des Zeichensatzes und der Sortierregeln:
[mysqld] character-set-server = utf8mb4 collation-server = utf8mb4_unicode_ci
1
2
3
MariaDB neu starten
Nach dem Ändern der MariaDB-Konfigurationsdatei muss der MariaDB-Dienst neu gestartet werden, um die Änderungen zu übernehmen. Dies kann über die Verwaltungsschnittstelle von ServBay oder mit dem Befehlszeilentool servbayctl
geschehen.
Neustart über die ServBay-Verwaltungsschnittstelle
- Öffnen Sie die ServBay-Verwaltungsschnittstelle.
- Navigieren Sie zu
Dienste
. - Finden Sie den entsprechenden MariaDB-Dienst und klicken Sie auf die Schaltfläche
Neustart
.
Neustart über servbayctl
Mit dem Befehlszeilentool servbayctl
kann der MariaDB-Dienst einfach neu gestartet werden:
servbayctl restart mariadb 11.5
Zusammenfassung
In ServBay befinden sich die MariaDB-Konfigurationsdateien im Verzeichnis /Applications/ServBay/etc/mariadb/<version>
, einschließlich my.cnf
. Nach dem Bearbeiten dieser Konfigurationsdateien kann der MariaDB-Dienst über die Verwaltungsschnittstelle von ServBay oder mit dem Befehlszeilentool servbayctl
neu gestartet werden, um die Änderungen zu übernehmen.