Jump to content

[mySQL Socket] MTA FairPlay


Killer...

Recommended Posts

Hello Everyone, i need your help. Im doing an MTA Fairplay server and...when i uplodaded it to the VPS, it tell's my this error.

[2015-03-07 11:21:30] ERROR: roleplay-accounts/s_accounts.lua:174: dbConnect failed; Can't connect to local MySQL server through socket '' (111) 
[2015-03-07 11:21:30] Error: MySQL connection is not established! 
[2015-03-07 11:21:30] ERROR: roleplay-accounts/s_webserver.lua:85: dbConnect failed; Can't connect to local MySQL server through socket '' (111) 
[2015-03-07 11:21:30] Error: MySQL web_connection is not established! 
  

And i went to the script of s_accounts.lua:174 and s_webserver.lua:85, but there's no space por put the socket or something. Please help.

Link to comment

Try adding ;unix_socket=/var/run/mysqld/mysqld.sock (including the ; at the front) to the end of the 2nd parameter string (host)

eg:

test_db = dbConnect( "mysql", "dbname=frank;host=1.2.3.4;unix_socket=/var/run/mysqld/mysqld.sock", "username", "password", "share=1" ) 

Link to comment
function testSQLConnection() 
    if (connection) then 
        local query = dbQuery(connection, "SELECT `??` FROM `??` WHERE `??` = '??' LIMIT 1", "value", "config", "key", "motd") 
        if (query) then 
            local result, num_affected_rows, errmsg = dbPoll(query, -1) 
            if (num_affected_rows > 0) and (type(result) == "table") then 
                for result,row in pairs(result) do 
                    if (row["value"]) then 
                        outputServerLog("Notice: Connection is working!") 
                        g_motd = row["value"] 
                    end 
                end 
            else 
                outputServerLog("Error: MySQL query failed.") 
            end  
        else 
            outputServerLog("Error: MySQL query failed.") 
        end 
    else 
        outputServerLog("Error: Could not test the query connection due to no stable MySQL connection.") 
        outputServerLog("... attempting a repair ...") 
        test_db = dbConnect( "mysql", "dbname=tlvrp;host=localhost;unix_socket=/var/lib/mysql/mysql.sock", "tlvrp", "gabriel32", "share=1" ) 
        if (not connection) then 
            outputServerLog("... repair failed!") 
        else 
            outputServerLog("... repair successful!") 
        end 
    end 
end 

The error is the same

Link to comment
absolutely nothing changed in the debug message?

Thanks man, i put it on the

addEventHandler("onResourceStart", resourceRoot, 
    function() 
        aclReload() 
        connection = dbConnect( "mysql", "dbname=tlvrp;host=localhost;unix_socket=/var/lib/mysql/mysql.sock", "tlvrp", "gabriel32", "share=1" ) 
         
        if (not connection) then 
            outputServerLog("Error: MySQL connection is not established!") 
        else 
            outputServerLog("Notice: MySQL connection is established!") 
            testSQLConnection() 
        end 
         
        setTimer(function() 
            reconnectSQL() 
        end, 60000*5, 0) 
         
        for i,v in ipairs(getElementsByType("player")) do 
            if (isClientInTutorial(v)) then 
                local x, y, z = tonumber(getElementData(v, "roleplay:temp.x")), tonumber(getElementData(v, "roleplay:temp.y")), tonumber(getElementData(v, "roleplay:temp.z")) 
                setElementPosition(v, x, y, z) 
                setElementInterior(v, 0) 
                setElementDimension(v, 0) 
                setCameraTarget(v, v) 
                setElementRotation(v, 0, 0, 90) 
                setElementFrozen(v, false) 
                setElementData(v, "roleplay:accounts.state", 2, true) 
                removeElementData(v, "roleplay:temp.md5rofl") 
                removeElementData(v, "roleplay:temp.x") 
                removeElementData(v, "roleplay:temp.y") 
                removeElementData(v, "roleplay:temp.z") 
                setElementData(v, "roleplay:accounts.option3", 1, false) 
                dbExec(connection, "UPDATE `??` SET `??` = '??' WHERE `??` = '??'", "accounts", "option_3", 1, "id", getAccountID(v)) 
                toggleAllControls(v, true, true, true) 
            end 
        end 
    end 
) 

Because after i used the test mysql. Thanks Men :D

Link to comment
  • 3 months later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...