# Configure MariaDB

Installing a MariaDB server is useful for development, or for running your own Whois server.

# Configuration

Set the following variables in the MariaDB configuration (location varies depending on installation, the configuration file is normally called my.cnf).

# Development machine

If MariaDB was installed through brew on an Apple Silicon machine, new configuration files can be added under /opt/homebrew/etc/my.cnf.d/.

Add the following configuration (e.g. in ripedb.cnf):

[server]
default-time-zone=+00:00
innodb_file_per_table = OFF
max_connections=1000

# Running your own Whois server

If you wish to run your own Whois server, you need additional variables to be modified:

  • max_allowed_packet = 20M

    • We need big packet sizes as some objects are very big
    • Default is 1M
    • Ref. https://mariadb.com/kb/en/mariadb/server-system-variables/#max_allowed_packet
  • innodb_buffer_pool_size = 2G

    • as we only have innodb databases, this should be set to use all the remaining memory available
    • leave some memory for the OS, and the Whois Java process, and check for swap activity
    • default is 128MB
    • Ref. https://mariadb.com/kb/en/mariadb/xtradbinnodb-server-system-variables/#innodb_buffer_pool_size

Restart MariaDB once all configuration changes have been made.

# Configure access to the database

  • Check if MariaDB is running mysqladmin -u root -p ping
  • Login to MariaDB using mysql -u root -p (or mysql with the default setup)
  • Create users:
CREATE USER 'dbint'@'localhost' IDENTIFIED BY '';
GRANT ALL PRIVILEGES ON *.* TO 'dbint'@'localhost';
CREATE USER 'rdonly'@'localhost' IDENTIFIED BY '';
GRANT SELECT PRIVILEGES ON *.* TO 'rdonly'@'localhost';

Logout with CTRL+D