Skip to content

2.1. Configuration: Database

Nairda edited this page Mar 16, 2021 · 3 revisions

bhoptimer supports custom database configurations.

By default, bhoptimer will use a local SQLite database called "shavit". However, you can use your own SQLite database or even a MySQL/MariaDB connection.

Path to configuration file: addons/sourcemod/configs/databases.cfg

SQLite

Open addons/sourcemod/configs/databases.cfg and add a shavit entry, like so.

"Databases"
{
	// other configurations here

	"shavit"
	{
		"driver"	"sqlite"
		"database"	"shavit"
	}
}

MySQL/MariaDB

Remote MySQL servers might work too, however; bhoptimer is designed with low ping (<5ms/socket) database connections in mind. I cannot support issues with remote databases. If you experience issues with MySQL/MariaDB, SQLite might be better for you.

Open addons/sourcemod/configs/databases.cfg and add a shavit entry, example:

"Databases"
{
	// other configurations here

	"shavit"
	{
		"driver"	"mysql"
		"host"		"127.0.0.1"
		"database"	"bhoptimer"
		"user"		"shavit"
		"pass"		"123_My_Safe_Password_#@!"
	}
}

Note: host should be either an IP address or a valid domain name (It's always the IP address and not a domain name on servers hosted on Linux - Common and known SourceMod issue yet to be addressed by the SourceMod devs). In case it is a domain name - to verify, open a command prompt/terminal emulator and run nslookup <domain>. There should not be any prefix (no http://, no https:// at all).

Table Prefix

Path to configuration file: addons/sourcemod/configs/shavit-prefix.txt

In some unusual setups, you'll need a table prefix. That's not the situation most of the time.
So tables like user will show up as PFX_users in your database, if "PFX_" is your prefix.
To setup a prefix, open addons/sourcemod/configs/shavit-prefix.txt and fill the file with your desired table prefix. Restart the server for the changes to applied. Your tables will be created from scratch with the new desired prefix.