Connecting to the MySQL Database

From ALFA
Jump to: navigation, search

Note! This page is deprecated. See Basic Host Requirements for game server database setup. This page is only kept for historical referenced.

See Basic Host Requirements: Configuration for details on how to set up DatabaseConnector.ini to manage the SSH tunnel used to connect to MySQL.


Follow these instructions:

  1. Download and extract the following NWNX4 files from the link below to a dedicated folder on your host machine (eg. C:\NWNX4):
    • NWNX4_Controller.exe
    • NWNX4_GUI.exe
    • madCHook.dll
    • NWNX4_Hook.dll
    • xp_mysql.dll
    • xp_time.dll
    • nwnx.ini
    • xp_mysql.ini
  2. Copy the madCHook.dll file to your Neverwinter Nights 2 game folder (where the game installed itself).
  3. You will need to configure nwnx.ini with your module and game information. The most important line is the parameters entry:
    parameters = -module "<My Module>" -servervault 1 -publicserver 1
    If you prefer to launch your module in directory mode, use the -moduledir paramater in place of -module.
  4. You will need to configure xp_mysql.ini with the correct connection details for the remote database server. Please contact the IA, TA, or DMA for that information.
  5. Once you have the file configured, you can launch your server using the NWNX4_GUI.exe program (NOT nwn2server.exe as you normally would). It will automatically launch nwn2server for you.
    Alternatively, you can install NWNX4 as a service on your host machine by issuing the following commands in your NWNX4 folder (only recommended for advanced users):
    NWNX4_Controller.exe -installservice
    NWNX4_Controller.exe -startservice
    NWNX4 will show up as a Windows service, which can be started and stopped like any other service on your machine (via Services in Administrative Tools). You can enable the nwn2server dialog window by navigating to the NWNX4 service, clicking on its properties, selecting the "Log On" tab, and checking the "Desktop Interaction" box.
    Other service commands you can issue using NWNX4_Controller.exe:
    -serviceno -- Specify service instance number
    -stopservice -- Stop the NWNX service
    -uninstallservice -- Uninstall the NWNX service
    -interactive -- Start in interactive mode

Note: NWNX logs are recorded in the nwnx.txt file, and MySQL logs are recorded in the StandardQueryLog.txt (formerly xp_mysql.txt) file in the install folder. These will help you identify any configuration or run time sql problems (like bad queries).