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.
Why MariaDB?
Section titled “Why MariaDB?”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.
Install
Section titled “Install”The simplest path on Ubuntu 22.04 / 24.04 — the distro repo carries a recent enough MariaDB:
sudo apt updatesudo apt install mariadb-serverUse this if you want a newer release than your distro ships.
sudo apt install curl gnupg ca-certificates apt-transport-httpssudo curl -o /etc/apt/keyrings/mariadb-keyring.pgp \ 'https://mariadb.org/mariadb_release_signing_key.pgp'echo "deb [signed-by=/etc/apt/keyrings/mariadb-keyring.pgp] \ https://deb.mariadb.org/10.11/ubuntu $(lsb_release -cs) main" \ | sudo tee /etc/apt/sources.list.d/mariadb.listsudo apt updatesudo apt install mariadb-serverThe MariaDB Repository Configuration Tool generates the equivalent snippet for any distro / version combination.
Ubuntu also ships a usable MySQL:
sudo apt updatesudo apt install mysql-serverThe Granting permission syntax differs slightly on MySQL 8+ — see the tabs in that section.
Secure the install
Section titled “Secure the install”Run the secure-install wizard once. It sets the root password, removes anonymous users, and disallows remote root login:
sudo mysql_secure_installationAccept 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.
Configure for remote connections
Section titled “Configure for remote connections”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:
-
Open the MariaDB config. On Ubuntu this is typically:
/etc/mysql/mariadb.conf.d/50-server.cnf -
Find the
bind-addressline. Either:- Comment it out by prefixing with
#, or - Set it to
0.0.0.0(IPv4) or::(IPv4 + IPv6) to listen on all interfaces.
- Comment it out by prefixing with
-
Restart the service:
Terminal window sudo systemctl restart mariadb# or, for MySQL:sudo systemctl restart mysql
Granting permission
Section titled “Granting permission”Sign into the database shell to create a user and database for SourceBans++:
# MariaDB:sudo mariadb -u root -p
# or MySQL:sudo mysql -u root -pEnter 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.phpand the SourceMod plugins save it indatabases.cfg. - A source host —
localhostif 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.
Older MySQL still accepts the combined form:
CREATE DATABASE IF NOT EXISTS `sourcebans` CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
GRANT ALL PRIVILEGES ON `sourcebans`.* TO 'USERNAME'@'HOST' IDENTIFIED BY 'PASSWORD';
FLUSH PRIVILEGES;Migrate to the two-statement form whenever you upgrade past MySQL 5.7.
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.