Hello facepunch
I noticed that my server gives errors about the database, it can connect but cannot query, first I thought there was a firewall problem with vilayer or something, but then they said the port is not blocked. So I tried to query something from my local pc, and the result was, that tmysql4 could connect, but as soon as the query was ran, it didn't go any further, the user got full access to the database though..
[B]MySQL log[/B](Error log is empty)
[code]
160203 0:15:35 188 Connect DATABASE@IPADDRESS on DATABASE
189 Connect DATABASE@IPADDRESS on DATABASE
190 Connect DATABASE@IPADDRESS on DATABASE
189 Query SELECT * FROM actions
[/code]
[B]Function[/B](*Ignore function names etc, since I just ripped that part from an old addon to test it real quick)
[code]
pltceranks = pltceranks or {}
require("tmysql4")
--------------------------------------------------
-- Database stuffs
--------------------------------------------------
function pltceranks.connecttodb()
print("[PLTCE Ranks] - Connecting to database.")
pltceranks.db, pltceranks.err = tmysql.initialize("SOMESHITTYIP", "DATABASEUSER", "DATABASEPASSWORD", "DATABASE", 3306)
if pltceranks.db and !pltceranks.err then
print("[PLTCE Ranks] - Connected to database.")
pltceranks.db:Query("SELECT * FROM actions", function(results)
PrintTable( results[1].data )
print('blah')
end)
else
print("[PLTCE Ranks] - Connection to database failed! '"..pltceranks.err.."'")
end
end
pltceranks.connecttodb()
[/code]
[B]Result[/B]
[code]
[PLTCE Ranks] - Connecting to database.
[PLTCE Ranks] - Connected to database.
[/code]
Nothing else. the whole query function doesnt get ran, since anyhting I do in it, wont get used, not even like print('test'). I hope you really can help me there..
IF IT REALLY MATTERS: We're using Plesk Web Pro on our server, and I tried it with, and without plesks firewall(firewall obviously allowed mysql), both results were the same, bind-address is 0.0.0.0 & the plesk webconfig says remote connections are allowed.
Better post this in the [URL="https://facepunch.com/showthread.php?t=1442438"]official tmysql release thread[/URL] instead
Try spawning a bot. Tmysql works by hooking the lua function tmysql.PollAll with the think hook. The think hook will only execute when the server isn't in hibernation mode.
Although you can call this function yourself and it will work :)
Update - Now it prints the query, I dont know why(since I didnt change anything on the vps), could it be the server somehow was delayed? (didnt even need to spawn a bot), I cant test it live on the server yet, since the owner isn't on to reboot it, but yeah.
Not sure if you can connect and query within the same function. You should intialize in another function then called db:connect or db:disconnect etc.
it works completely fine in the same function, has nothing to do with it.
Sorry, you need to Log In to post a reply to this thread.