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:
...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.
Ganymede last edited by
You're not an idiot.
These inquiries are why the sub-forum exists, and I'm delighted that it is being used.
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.
I'm not 100% sure, which is pretty embarrassing!
When I check version() I get this:
MUX 184.108.40.206 #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?
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.
In src folder:
./configure --enable-inlinesql --enable-realitylvls --enable-stubslave make depend make
In the src/modules folder:
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
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.
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!