Post Thu May 31, 2012 8:22 pm

How To Install and Troubleshoot Garry's Mod and MySQL

This is a tutorial on how to install a Garry's Mod gamemode requiring a MySQL database using our v4.0 control panel. This example uses TacoScript Classic 1.1, but the techniques described should be applicable to other gamemodes requiring a MySQL database. Note that UltimateGameHost does not own or control any of these addons or gamemodes and their copyright remains with their respective owners.

1. Extract the archive: On your computer, extract the .zip file (if there is one) that you downloaded. Open up any readme, instructions, etc. files that are provided in the .zip and follow those instructions over and above the general directions here. For TacoScript Classic, the file of interest is requiredmodules.txt which lists the LUA binaries we need to install.

2. Upload with FTP: Upload the addons, gamemodes, and data (if these are present) to their respective folders using your FTP access (you will need to use Filezilla or a different FTP client to do this). For our specific example, this means uploading from the tsc-1.1.zip file addons\TacoscriptContent to the addons folder, gamemodes\TacoScript to the gamemodes folder, and data\TacoScript to the data folder.

Note: it's important that you create/upload a subdirectory for the addon/gamemode and then immediately in that subdirectory should be an info.txt file. For gamemodes there would also be entities and gamemode subdirectories along with info.txt. For addons the directories vary, but usually there are materials and models.

3. Install LUA binaries: Most gamemodes in Garry's Mod that use MySQL use the gm_mysqloo library. If the archive contains these binaries use them, otherwise you can download them off facepunch in the Garry's Mod, L.U.A. Scripting -> Binary Modules section, http://www.facepunch.com/forums/70

For TacoScript Classic, we need gm_rcon, gm_mysqloo, and gm_gatekeeper. Looking on facepunch the corresponding threads are:

gm_rcon: http://facepunch.com/showthread.php?t=948263 [download link appears broken in the thread, use this link http://code.google.com/p/christophertho ... elease?r=7]
gm_mysqloo: http://www.facepunch.com/showthread.php?t=933647
gm_gatekeeper: http://facepunch.com/showthread.php?t=695636

The gmsv_mysqloo.dll, gmcl_mysqloo.dll, gmsv_gatekeeper.dll, and gmsv_rcon.dll files go in lua/includes/modules, upload them using FTP.

4. Get MySQL Connection Info: Get the MySQL username, password, dbname, and other details from the control panel (Extras -> MySQL Database -> Login Info). If you haven't installed the MySQL extra already, do so now and return to the tab after the browser refresh. Copy down the information in the login info box.

Image

5. Configure the gamemode to use MySQL: this varies by gamemode, but for TacoScript it's in data/TacoScript/mysqlconfig.txt. Open this file using Filezilla and edit the appropriate lines. For example (DO NOT use these exact values, you should use the values as provided in step 4 for your specific gameserver):

MySQLDediIP=127.0.0.1
MySQLDediUser=dc26acfa2_dbuser
MySQLDediPass=df19ab9e9
MySQLDediDB=dc26acfa2_cp
MySQLDediPort=3306

6. Install the SQL Schema: this also varies by gamemode, but open any .sql file provided by the gamemode and copy/paste it's contents into the Extras -> MySQL Database run sql command box and click Run SQL. For TacoScript, this is the file tacoscriptclassic.sql. If it succeeds you should see Query successful, 0 row(s) affected. for each table creation. You can view the tables with a show tables; statement.

Image

7. Confirming your Settings: join the server, (gamemode dependent) pass the quiz and create your character. Disconnect and return to the control panel, Extras -> MySQL Database. You can view the contents of the tables to verify your character is now stored in the database. For TacoScript, run these commands:

select * from ts_users;
select * from ts_characters;

Image


Troubleshooting (using example errors from TacoScript Classic 1.1 at various stages):

Use the console output to see LUA startup errors, these errors often will not show in the server logs. You can access your console logs in the control panel, turn on console logging if it isn't already and click refresh to get the latest list.


Issue: mysqloo not found in console
Resolution: This means the LUA binaries have not been installed yet.

Image

ERROR! Module 'mysqloo' not found!
=== ATTEMPTING TO CONNECT TO SQL ===
=== MYSQL MODULE NOT FOUND ===
ERROR! Module 'gatekeeper' not found!
ERROR! Module 'rcon' not found!
Server start
Registering gamemode 'TacoScript' derived from 'sandbox'


Issue: error loading mysqloo module
Resolution: This means libmysql.dll is not installed in the orangebox folder. Go to Extras -> MySQL Database and either install the database extra or click the Reinstall DB button (be cautious here, reinstalling the db will wipe out any data you currently have). After installing or reinstalling the database, restart the server.

Image

error loading module 'mysqloo' from file 'z:\zakal\servers\accounts\c26acfa2\orangebox\garrysmod\lua\includes\modules\gmsv_mysqloo.dll':
Module not found


Issue: the server never comes up
Resolution: You need to configure the gamemode to use the correct mysql connection information (see steps 4 and 5).

Image

The server never comes up, and the last line in the console log is === ATTEMPTING TO CONNECT TO SQL ===


Issue: failed to retrieve addess
Resolution: This usually means the module in question (in this case gmsv_rcon.dll) can't find an entry point in the game libraries. There's not really any way for you to fix this, so ignore it (it does mean the module may not work). This usually happens when an incompatible change to the orangebox engine occurs. The only solution is for a new version to be released by the developer.


Image

[gmsv_rcon] Failed to retrieve address of CServerRemoteAccess::WriteDataRequest
[gmsv_rcon] Failed to retrieve address of CServerRemoteAccess::LogCommand
[gmsv_rcon] Failed to retrieve address of CServerRemoteAccess::CheckPassword


Issue: You get Disconnected with the error Private testing is currently in session:
Resoultion: By default TacoScript only allows select steam ids. To change this open the file gamemodes/TacoScript/gamemode/server_security.lua and change EXCLUSIVE_TESTING from true to false. Restart the server afterwards.