Skip to content

2.1. Configuration: Database

shavit edited this page Aug 2, 2017 · 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_#@!"
	}
}

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.