Modify MariaDB Settings
ServBay comes with a MariaDB database and provides flexible configuration options. This article will detail how to modify MariaDB settings in ServBay, including the location of configuration files and common configuration items. Depending on the version of MariaDB, these files are located in the /Applications/ServBay/etc/mariadb/<version>
directory.
Important Notice
Please do not manually modify the configuration files. All configuration files are automatically generated by ServBay, and manual modifications may be overwritten. Please use the UI to make changes.
Modify Using ServBay's UI
ServBay includes a powerful graphical management interface where users can modify various configuration parameters directly in the management interface. After clicking save, the changes will automatically apply and take effect in real-time, eliminating the hassle of manually editing parameters.
Users can access the ServBay left navigation bar, select Database
- MariaDB
, and then choose the corresponding version to edit and modify MySQL configurations.
In the graphical editing interface, users can not only access the default MariaDB username and root password but also modify the MariaDB listening address bind-address
and port port
(default is 0.0.0.0:3306
). Additionally, users can enable slow query log
, and configure settings such as max_connections
and max_allowed_packet
.
After making changes, users can click the Save
button to apply the modifications, which will take effect immediately.
Modify by Manually Editing Configuration Files
WARNING
Manually editing configuration files is only suitable for temporary changes to some configuration items.
We do not recommend manually modifying MariaDB configuration files because all changes will be overwritten by ServBay.
Overview
In ServBay, MariaDB configuration files are stored in different directories depending on the version. For example, the configuration files for MariaDB 11.5 are located in the /Applications/ServBay/etc/mariadb/11.5
directory. The primary configuration file is my.cnf
.
Configuration File Location
my.cnf
:/Applications/ServBay/etc/mariadb/<version>/my.cnf
my.cnf
my.cnf
is the main configuration file for MariaDB, used to set runtime options for the database server.
Common Configuration Items
Modify Listening Address:
[mysqld] bind-address = 0.0.0.0
1
2Modify Port Number:
[mysqld] port = 3306
1
2Modify Maximum Connections:
[mysqld] max_connections = 200
1
2Modify Buffer Pool Size:
[mysqld] innodb_buffer_pool_size = 256M
1
2Modify Log File Path:
[mysqld] log_error = /Applications/ServBay/logs/mariadb/error.log
1
2Enable Slow Query Log:
[mysqld] slow_query_log = 1 slow_query_log_file = /Applications/ServBay/logs/mariadb/slow.log long_query_time = 2 # Record queries taking longer than 2 seconds
1
2
3
4Modify Character Set and Collation:
[mysqld] character-set-server = utf8mb4 collation-server = utf8mb4_unicode_ci
1
2
3
Restart MariaDB
After modifying the MariaDB configuration file, you need to restart the MariaDB service to make changes take effect. You can restart it through the ServBay management interface or use the servbayctl
command line tool.
Restart Through ServBay Management Interface
- Open the ServBay management interface.
- Navigate to
Services
. - Find the corresponding version of the MariaDB service and click the
Restart
button.
Restart Using servbayctl
The servbayctl
command line tool allows you to easily restart the MariaDB service:
servbayctl restart mariadb 11.5
Summary
In ServBay, the MariaDB configuration files are located in the /Applications/ServBay/etc/mariadb/<version>
directory, including my.cnf
. After modifying these configuration files, you can restart the MariaDB service through the ServBay management interface or using the servbayctl
command line tool to apply the changes.