-
Notifications
You must be signed in to change notification settings - Fork 2
Database guide
azalty edited this page Jul 31, 2021
·
4 revisions
It's really easy to set up the database, but it could be a little more difficult if you don't know how to do it.
First, if you want:
- A fast, easy to setup database that will only be used by one server: I recommend using SQLite, it's a local database, which makes requests faster, but can only be accessed by the server it was created on. It's also a good thing if you change your mind and want to remove this plugin, since you'll only have to delete one file. Click here to choose SQLite!
- A database that will be shared between multiple servers or will be called by other systems: you should use a MySQL database. I hope that you know how to create one, since I don't know! (I'll show you how to add it to sourcemod though) Click here to choose MySQL!
Go to sourcemod/configs/databases.cfg
and add this inside "Databases"
"no_dupe_account"
{
"driver" "sqlite"
"database" "no_dupe_account"
}
This will look like that:
"Databases"
{
"driver_default" "mysql"
// When specifying "host", you may use an IP address, a hostname, or a socket file path
"default"
{
"driver" "default"
"host" "localhost"
"database" "sourcemod"
"user" "root"
"pass" ""
//"timeout" "0"
//"port" "0"
}
"storage-local"
{
"driver" "sqlite"
"database" "sourcemod-local"
}
"clientprefs"
{
"driver" "sqlite"
"host" "localhost"
"database" "clientprefs-sqlite"
"user" "root"
"pass" ""
//"timeout" "0"
//"port" "0"
}
// other configs that you have..
"no_dupe_account"
{
"driver" "sqlite"
"database" "no_dupe_account"
}
}
Now restart your server or enter the command sm_rcon sm_reload_databases
and 🎉 you're done!
Create your database (check your host, or create it yourself if you know how to do it), and then go to sourcemod/configs/databases.cfg
and add this inside "Databases"
"no_dupe_account"
{
"driver" "mysql"
"host" ""
"database" "no_dupe_account"
"user" ""
"pass" ""
}
Fill host
, user
and pass
with the appropriate informations
It will look like that:
"Databases"
{
"driver_default" "mysql"
// When specifying "host", you may use an IP address, a hostname, or a socket file path
"default"
{
"driver" "default"
"host" "localhost"
"database" "sourcemod"
"user" "root"
"pass" ""
//"timeout" "0"
//"port" "0"
}
"storage-local"
{
"driver" "sqlite"
"database" "sourcemod-local"
}
"clientprefs"
{
"driver" "sqlite"
"host" "localhost"
"database" "clientprefs-sqlite"
"user" "root"
"pass" ""
//"timeout" "0"
//"port" "0"
}
// other configs that you have..
"no_dupe_account"
{
"driver" "mysql"
"host" "127.0.0.1"
"database" "no_dupe_account"
"user" "nda"
"pass" "mysuperpassword"
}
}
Now restart your server or enter the command sm_rcon sm_reload_databases
and 🎉 you're done!