Skip to content

Database setup

SourceBans++ needs a MySQL- or MariaDB-compatible database. This page walks through installing MariaDB on Ubuntu (the most common self-host path) and creating the user and database the panel will use.

If you already run MySQL or MariaDB and just need the user / grant syntax, jump straight to Granting permission.

If you’re on shared hosting (cPanel, Plesk, DirectAdmin, …) you don’t need any of this — your control panel has a “Create database” wizard that gives you the host, name, user, and password. Use those values directly in the SourceBans++ install wizard.

MariaDB is a drop-in MySQL replacement maintained by the original MySQL authors. SourceBans++ supports both engines equally — we just recommend MariaDB by default because:

  • It’s what our dev stack and CI run against.
  • It’s available in every major distro’s package repo at a recent enough version.
  • Its licence is permissive (GPL), so most hosts ship it without the Oracle / Sun licensing constraints that wrap MySQL.

If your host already provides MySQL, that’s perfectly fine.

The simplest path on Ubuntu 22.04 / 24.04 — the distro repo carries a recent enough MariaDB:

Terminal window
sudo apt update
sudo apt install mariadb-server

Run the secure-install wizard once. It sets the root password, removes anonymous users, and disallows remote root login:

Terminal window
sudo mysql_secure_installation

Accept the defaults unless you have a specific reason not to. The root password it sets is for the database root account, not your OS root — pick something different from your sudo password.

Skip this section if the web panel and game servers all connect to the database from the same host (localhost). The defaults work as-is.

If the panel and / or game servers are on a different host:

  1. Open the MariaDB config. On Ubuntu this is typically:

    /etc/mysql/mariadb.conf.d/50-server.cnf
  2. Find the bind-address line. Either:

    • Comment it out by prefixing with #, or
    • Set it to 0.0.0.0 (IPv4) or :: (IPv4 + IPv6) to listen on all interfaces.
  3. Restart the service:

    Terminal window
    sudo systemctl restart mariadb
    # or, for MySQL:
    sudo systemctl restart mysql

Sign into the database shell to create a user and database for SourceBans++:

Terminal window
# MariaDB:
sudo mariadb -u root -p
# or MySQL:
sudo mysql -u root -p

Enter the root password you set during mysql_secure_installation.

Decide on three values:

  • A username — by convention, sourcebans.
  • A password — pick a strong one; the panel saves it in config.php and the SourceMod plugins save it in databases.cfg.
  • A source hostlocalhost if everything’s on the same machine, the IP of the other host, or % to allow any source IP (paired with a firewall rule, please).

Then create the database, the user, and grant access:

Modern MariaDB and MySQL 8 dropped the combined GRANT … IDENTIFIED BY syntax. Use two statements:

CREATE DATABASE IF NOT EXISTS `sourcebans`
CHARACTER SET utf8mb4
COLLATE utf8mb4_unicode_ci;
CREATE USER 'USERNAME'@'HOST' IDENTIFIED BY 'PASSWORD';
GRANT ALL PRIVILEGES ON `sourcebans`.* TO 'USERNAME'@'HOST';
FLUSH PRIVILEGES;

Replace USERNAME, HOST, and PASSWORD with your three chosen values. If you picked a different database name, swap sourcebans for it on both the CREATE DATABASE and GRANT lines.

The utf8mb4 charset is required — SourceBans++ won’t insert player names with emoji or some CJK characters into a 3-byte utf8 table.

You now have a database, a user, and a password. Head back to the Quickstart and fill in the install wizard with those values.