Изменение настроек MariaDB
ServBay поставляется с базой данных MariaDB и предоставляет гибкие варианты настройки. В этой статье подробно объясняется, как изменить настройки MariaDB в ServBay, включая местоположение файлов конфигурации и общие конфигурационные параметры. В зависимости от версии MariaDB, эти файлы находятся в каталоге /Applications/ServBay/etc/mariadb/<version>
.
Обзор
В ServBay файлы конфигурации MariaDB хранятся в разных каталогах в зависимости от версии. Например, конфигурационные файлы для MariaDB 11.5 находятся в каталоге /Applications/ServBay/etc/mariadb/11.5
. Главный конфигурационный файл — my.cnf
.
Местоположение файлов конфигурации
my.cnf
:/Applications/ServBay/etc/mariadb/<version>/my.cnf
Общие конфигурационные параметры и способы изменения
my.cnf
my.cnf
— это основной конфигурационный файл MariaDB, используемый для настройки параметров работы сервера базы данных.
Общие конфигурационные параметры
Изменение адреса для прослушивания:
[mysqld] bind-address = 0.0.0.0
1
2Изменение номера порта:
[mysqld] port = 3306
1
2Изменение максимального количества соединений:
[mysqld] max_connections = 200
1
2Изменение размера буферного пула:
[mysqld] innodb_buffer_pool_size = 256M
1
2Изменение пути к файлам журналов:
[mysqld] log_error = /Applications/ServBay/logs/mariadb/error.log
1
2Включение журнала медленных запросов:
[mysqld] slow_query_log = 1 slow_query_log_file = /Applications/ServBay/logs/mariadb/slow.log long_query_time = 2 # В секундах, регистрировать запросы, выполнение которых превысило 2 секунды
1
2
3
4Изменение набора символов и правила сортировки:
[mysqld] character-set-server = utf8mb4 collation-server = utf8mb4_unicode_ci
1
2
3
Перезагрузка MariaDB
После изменения конфигурационного файла MariaDB нужно перезапустить службу MariaDB, чтобы изменения вступили в силу. Это можно сделать через интерфейс управления ServBay или с помощью командной строки servbayctl
.
Перезагрузка через интерфейс управления ServBay
- Откройте интерфейс управления ServBay.
- Перейдите в раздел
Сервисы
. - Найдите службу соответствующей версии MariaDB и нажмите кнопку
Перезагрузить
.
Перезагрузка с помощью servbayctl
С помощью командной строки servbayctl
можно легко перезапустить службу MariaDB:
servbayctl restart mariadb 11.5
Резюме
В ServBay конфигурационные файлы MariaDB находятся в каталоге /Applications/ServBay/etc/mariadb/<version>
, включая my.cnf
. После изменения этих конфигурационных файлов можно перезапустить службу MariaDB через интерфейс управления ServBay или с помощью командной строки servbayctl
, чтобы изменения вступили в силу.