Modify MariaDB Settings
ServBay comes with the MariaDB database and offers flexible configuration options. This document will detail how to modify MariaDB settings in ServBay, including the location of configuration files and common configuration items. These files are located in the /Applications/ServBay/etc/mariadb/<version>
directory depending on the version of MariaDB.
Overview
In ServBay, MariaDB's configuration files are stored in different directories depending on the version. For example, the configuration file for MariaDB 11.5 is located in the /Applications/ServBay/etc/mariadb/11.5
directory. The main configuration file is my.cnf
.
Configuration File Location
my.cnf
:/Applications/ServBay/etc/mariadb/<version>/my.cnf
Common Configuration Items and Modification Methods
my.cnf
my.cnf
is the main configuration file for MariaDB, used to set runtime options for the database server.
Common Configuration Items
Modify Listen 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 # In seconds, log queries that take 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 for the changes to take effect. You can restart through the ServBay management interface or by using the servbayctl
command line tool.
Restart Through the 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 Through servbayctl
You can conveniently restart the MariaDB service using the servbayctl
command line tool:
servbayctl restart mariadb 11.5
Conclusion
In ServBay, MariaDB's 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 by using the servbayctl
command line tool to make the changes effective.