Enabling SQL on TinyMUX



  • Because I clearly haven't established myself as enough of an idiot today, now begins the struggle to understand how to enable SQL on TinyMux.

    I'm looking at this:
    https://wiki.tinymux.org/index.php/SQL

    ...and it reads like Greek to me. "Change @query so that it calls sqlmaster instead", for example - What does that mean in practice? I looked at help @query and I see that there's a syntax example for calling a dbref, but not a sql database. What would the syntax look like for that? Do I need to run ./configure with any specific settings, and if so, what are they?

    Apologies in advance for all the stupid questions! New to MUX, but eager to get deeper into it.



  • You're not an idiot.

    These inquiries are why the sub-forum exists, and I'm delighted that it is being used.



  • @highfalutin Hi!

    So, TinyMUX has two ways to use SQL. One is @query. "We" don't really use that much. the other is the sql() command. To check your SQL connection, use th sql( select 1 ). What response do you get?

    Setting up SQL requires you to actually specify that option when you're, uh, building? the thingy. I suck at Linux, sorry. When you run the actual command to install TinyMUX, there's a --sql-inline or something option you append to it. If the above command doesn't work, that's what you need. ChimeMUX checks if you have SQL automatically, but the standard BrazilMUX does not. So... Run the above command. Let me know if it works. If not, I'll dig up the correct command line.



  • @skew said in Enabling SQL on TinyMUX:

    th sql( select 1 )

    Damn. I get this:

    #-1 FUNCTION (SQL) NOT FOUND

    (And thank you!)



  • @highfalutin said in Enabling SQL on TinyMUX:

    @skew said in Enabling SQL on TinyMUX:

    th sql( select 1 )

    Damn. I get this:

    #-1 FUNCTION (SQL) NOT FOUND

    (And thank you!)

    Are you using Brazil's latest release? Or ChimeMux? I noticed you linked to lashtear's GitHub elsewhere.



  • @skew

    I'm not 100% sure, which is pretty embarrassing!

    I used this guide:
    https://secure.thirdhosting.com/knowledgebase/12/Install-Guide-for-TinyMUX-Codebase.html

    For this:
    ftp://ftp.tinymux.org/tinymux-2.10/14/mux-2.10.1.14.unix.tar.gz

    When I check version() I get this:

    MUX 2.10.1.14 #3 [2017-AUG-05]



  • @highfalutin I much prefer ChimeMUX because it's possible to install it. And prefer Rhost over all of it, because omg so much easier. But enough whining, right?

    https://github.com/sean-brandt/tinymux/blob/master/mux/SQL

    Some actual instructions. Go down to "In-Line/Synchronous SQL" and that should be what you need. When you do the actual ./configure, you add those options on. As it says, if your MySQL is not in the right spot, if your user doesn't have the correct rights, etc, you'll need to deal with that. BUT... that'll do it.

    Doing the configure and rebuilding TinyMUX... shouldn't delete anything. But I'd back up first, just to be sure.



  • @skew You're a life-saver. Thank you, it's much appreciated.



  • Progress!

    In src folder:

    ./configure --enable-inlinesql --enable-realitylvls --enable-stubslave
    make depend
    make
    

    In the src/modules folder:

    ./configure
    make
    

    Added to netmux.conf:

    module sqlproxy
    module sqlslave
    
    sql_database username_muxtest
    sql_server localhost
    sql_user username_muxtest
    sql_password passwordishere
    

    Then @restarted in the game.

    I checked the logfile and saw this:

    2019.0119:011848 Eventide INI/LOAD : Couldn’t create interface to Query Server.

    Checked the function to see if it worked anyway:

    think [sql()]
    #-1 FUNCTION (SQL) NOT FOUND
    
    @query
    Query server is not available.
    

    Everything seems to be in the right spot:

    checking for location of SQL header files... /usr/include/mysql
    checking for location of SQL library files... /usr/lib/mysql

    I think I must be missing something... Does anything stick out?



  • Got it working with asychronous SQL, though I'm nervous that it doesn't provide the sql() function.

    Just in case anyone else needs it at some point:

    ./configure --enable-stubslave --with-mysql-include=/usr/local/mysql/include --with-mysql-libs=/usr/local/mysql/lib --enable-realitylvls
    make depend
    make
    
    Add to netmux.conf:
    
    module sqlproxy
    module sqlslave local
    
    sql_database username_muxtest
    sql_server localhost
    sql_user username_muxtest
    sql_password passwordhere
    

    Going to keep fiddling with inline.



  • Okay... I think the issue might be the location of the sql libaries, or something. With inline enabled, I get this on make depend:

    makefunctions.cpp:26:19: error: mysql.h: No such file or directory
    game.cpp:30:19: error: mysql.h: No such file or directory
    

    Makefile:

    INLINESQL         = -DINLINESQL
    INLINESQL_LIBS    = -L/usr/local/mysql/lib -lmysqlclient -lz
    INLINESQL_INCLUDE = -I/usr/local/mysql/include
    

    So! Is there anyone else on here who uses tinymux with SQL, and is hosted on Third Generation Hosting? Any chance you could tell me where the correct path?



  • AHHH! I GOT IT.

    Correct paths:

    INLINESQL_LIBS    = -L/usr/lib/mysql -lmysqlclient -lz
    INLINESQL_INCLUDE = -I/usr/include/mysql
    

    I have never seen a more beautiful error message:

    think [sql()]
    #-1 FUNCTION (SQL) EXPECTS BETWEEN 1 AND 3 ARGUMENTS
    


  • @highfalutin we use the inline, and really it's the only one you need. So, glad it's working!


Log in to reply