How do I connect DarkRP itself to a MySQL database?
This is different from just creating a database on the Databases page; DarkRP needs to be told to use it.
First, find the MySQLoo addon on the Steam Workshop - search "MySQLoo" from the in-game Workshop menu, or from the Steam Workshop site under Garry's Mod - and install it via Addon Manager or Workshop.
Then add a config block to darkrpvar.lua setting DarkRP.settings.mysqlHost, mysqlDatabase, mysqlUser, mysqlPassword, mysqlPort, and enableExternalDatabase = true, using the credentials from your Databases page.
One detail that catches people out: the host should always be 127.0.0.1, never your server's public IP, even though the database technically lives on the same infrastructure.
After restarting, look for "MySQLoo: Connection successful" in the console to confirm it worked.
Want to try this on a real server?
Everything described here is available on the trial too, on the same hardware and the same panel as the paid plans. Try it free for 24-hour, no credit card required.
Didn't fix it? Ask in Discord.
Ask in our Discord - we help with hosting questions whether or not you host with us.
Related articles
- How do I create and manage a panel database?
Panel Features