Post Thu May 31, 2012 8:40 pm

How to Setup SQL Admins for Sourcemod

This is a tutorial on how to install and configure SQL Admins for Sourcemod. Our example uses a Counter-Strike: Source server. More information on how to do this in general is available at

1. Install Sourcemod by going to Addons -> Common Addons if you haven't installed Sourcemod yet.

2. Go to Extras -> MySQL Database and install the database extra if you haven't already. Click the Login Info button to get your local MySQL connection details.

3. Use Filezilla (or your favorite FTP client) to login via FTP. Go to the addons -> sourcemod -> configs directory. Open the databases.cfg file and update the "default" section with your MySQL login details you found in step 2 (for Sourcemod you should use as opposed to localhost). Example (DO NOT copy this configuration, you will need to use the settings you found in step 2 which are unique per master account):

"driver" "default"
"host" ""
"database" "db236bf7e_cp"
"user" "db236bf7e_dbuser"
"pass" "d8c36af72"
//"timeout" "0"
//"port" "0"

Save the file and upload it back to the server. Restart the server afterwards.

4. Next you need to enable the SQL admin manager plugin and one other SQL plugin. See ... ng_Plugins for a guide of which other SQL plugin to use. You can enable these plugins by moving the .smx files around in Filezilla. Restart the server when you're done. Go to the RCON tab and enter sm plugins list. You should see two SQL plugins (in our case we chose to install SQL prefetch):

02 "SQL Admins (Prefetch)" (1.3.8) by AlliedModders LLC
14 "SQL Admin Manager" (1.3.8) by AlliedModders LLC

5. On Filezilla, go to addons -> sourcemod -> configs -> sql-init-scripts -> mysql and open the create_admins.sql file. Copy its contents and paste them in the MySQL command box on the Extras -> MySQL Database tab. Click Run SQL, you should see output similar to this picture:


6. Go to the RCON tab and run the following command to update the schema to the latest version (this also makes sure everything is up to date):



7. Restart the server, you should be all set. You can view the created tables with a show tables command:




L 05/27/2012 - 22:27:19: [admin-sql-prefetch.smx] Could not connect to database "default": [2002]: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

Please make sure you use instead of localhost in your databases.cfg file and confirm your database, user, and password settings all match the dialog in the control panel. If it still doesn't work contact us.


L 05/27/2012 - 22:29:05: [admin-sql-prefetch.smx] FetchOverrides() query failed: SELECT type, name, flags FROM sm_overrides
L 05/27/2012 - 22:29:05: [admin-sql-prefetch.smx] Query error: Table 'db236bf7e_cp.sm_overrides' doesn't exist

This indicates the tables aren't created yet. Please see Step 5 for information on creating the schema.